Skip to content

ESP8266WebServer chunked transfer is broken #6877

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
6 tasks done
hvxl opened this issue Dec 3, 2019 · 0 comments · Fixed by #6878
Closed
6 tasks done

ESP8266WebServer chunked transfer is broken #6877

hvxl opened this issue Dec 3, 2019 · 0 comments · Fixed by #6878

Comments

@hvxl
Copy link

hvxl commented Dec 3, 2019

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: [ESP-12]
  • Core Version: [074a801]
  • Development Env: [Arduino IDE]
  • Operating System: [openSUSE]

Settings in IDE

  • Module: [NodeMCU 1.0 (ESP-12E Module)]
  • Flash Mode: [qio]
  • Flash Size: [4MB]
  • lwip Variant: [v2 Lower Memory]
  • Reset Method: [nodemcu]
  • Flash Frequency: [40Mhz]
  • CPU Frequency: [80Mhz]
  • Upload Using: [SERIAL]
  • Upload Speed: [921600] (serial upload only)

Problem Description

Since 2.6.2 chunked HTTP is broken because the web server sends chunk lengths in the wrong location. For one thing, it's sending a chunk length before the headers. For example, the sketch below results in the following data being transmitted (as reported by wireshark):

71
HTTP/1.1 200 OK
Content-Type: text/plain
Accept-Ranges: none
Transfer-Encoding: chunked
Connection: close


0

Webserver bug!

Git bisect indicates that 36f9034 is the first bad commit.

MCVE Sketch

#include <ESP8266WebServer.h>

ESP8266WebServer server(80);

void handleRoot() {
  server.setContentLength(CONTENT_LENGTH_UNKNOWN);
  server.send(200, "text/plain", "");
  server.sendContent("Webserver bug!");
}

void setup() {
  Serial.begin(115200);
  WiFi.begin();
  while (WiFi.status() != WL_CONNECTED) delay(500);
  Serial.println(WiFi.localIP());
  server.on("/", HTTP_GET, handleRoot);
  server.begin();
}

void loop() {
  server.handleClient();
}

Debug Messages

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

Successfully merging a pull request may close this issue.

1 participant