Skip to content

ESP8266WebServer::send_P does not function the same as ESP8266WebServer::send #5182

Closed
@Makuna

Description

@Makuna

Basic Infos

  • This issue complies with the issue POLICY doc.
  • I have read the documentation at readthedocs and the issue is not addressed there.
  • I have tested that the issue is present in current master branch (aka latest git).
  • I have searched the issue tracker for a similar issue.
  • If there is a stack dump, I have decoded it.
  • I have filled out all fields below.

Platform

  • Hardware: [WEMOS D1 MINI]
  • Core Version: [ f776454 ]
  • Development Env: [Arduino IDE]
  • Operating System: [Windows 10]

Settings in IDE

  • Module: [Wemos D1 mini r2 & mini]
  • Flash Mode: [unknown (usb)]
  • Flash Size: [4MB]
  • lwip Variant: [v2 Lower Memory]
  • Reset Method: [ck|nodemcu]
  • Flash Frequency: [40Mhz]
  • CPU Frequency: [80Mhz]
  • Upload Using: [SERIAL]
  • Upload Speed: [921600] (serial upload only)

Problem Description

Using ESP8266WebServer::send_P will cause an empty content page to be sent when the data uses content length of zero.

Sketch

Start with the CaptivePortalAdvanced example sketch.

First, make the modification as found in #5013 so it will function correctly.

Then inside the handleHttp.h file, add the following at the top

const char* c_xmlTextHtml PROGMEM = "text/html";
const char* c_xmlEmpty PROGMEM = ""; // or even "\0\0\0\0\0\0\0\0" if the bug is still present about less than size 4 progmem variables.

and then change all the

server.send(200, "text/html", ""); 

to

  server.send_P(200, c_xmlTextHtml, c_xmlEmpty); 

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions