Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
5 of 6 tasks
Makuna opened this issue Sep 29, 2018 · 0 comments
Closed
5 of 6 tasks

Comments

@Makuna
Copy link
Collaborator

Makuna commented Sep 29, 2018

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); 
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant