- #1
- 862
- 504
I am trying out the web server feature on a NodeMCU ESP8266 board. If I include a Content-Length line in the response header, it works perfectly.
But if I omit the content-length, then Chrome and Firefox fail to display the page. Chrome displays a blank page, and Firefox says "Connection was reset".
This is the HTTP response as received on Telnet:
(There is a "\r\n" at the end of each line and after the header).
Curl and Wget also report "connection closed" errors.
My understanding is that if content-length is not specified, then closing the connection is a valid way to signal end of data. Especially with "connection: close". So what is the problem?
But if I omit the content-length, then Chrome and Firefox fail to display the page. Chrome displays a blank page, and Firefox says "Connection was reset".
This is the HTTP response as received on Telnet:
Code:
HTTP/1.1 200 OK
Content-Type: text/html
Connection: close
<html><body>Hello</body></html>
Connection closed by foreign host.
Curl and Wget also report "connection closed" errors.
My understanding is that if content-length is not specified, then closing the connection is a valid way to signal end of data. Especially with "connection: close". So what is the problem?