mirror of
https://github.com/esp8266/Arduino.git
synced 2025-06-17 22:23:10 +03:00
Chunked encoding (#2199)
* Add chunked encoding example: ```cpp server.on("/chunked", HTTP_GET, [](){ server.send(200, "text/html", String()); server.sendContent("<!DOCTYPE html><html><head><title>Chunked Test</title></head><body>"); server.sendContent("<p>Chunk 1</p>"); server.sendContent("<p>Chunk 2</p>"); server.sendContent("<p>Chunk 3</p>"); server.sendContent("<p>Chunk 4</p>"); server.sendContent("<p>Chunk 5</p>"); server.sendContent("<p>Chunk 6</p>"); server.sendContent("</html>"); server.sendContent("");//end of chunked }); ``` * update examples, keep setContentLength and add bool _chunked * fix wrong session id * set _chunked to false earlier for cases where users use only sendContent
This commit is contained in:
committed by
Ivan Grokhotkov
parent
6d3109e8c7
commit
6390cf6bd6
@ -86,6 +86,8 @@ bool ESP8266WebServer::_parseRequest(WiFiClient& client) {
|
||||
|
||||
String methodStr = req.substring(0, addr_start);
|
||||
String url = req.substring(addr_start + 1, addr_end);
|
||||
String versionEnd = req.substring(addr_end + 8);
|
||||
_currentVersion = atoi(versionEnd.c_str());
|
||||
String searchStr = "";
|
||||
int hasSearch = url.indexOf('?');
|
||||
if (hasSearch != -1){
|
||||
@ -93,6 +95,7 @@ bool ESP8266WebServer::_parseRequest(WiFiClient& client) {
|
||||
url = url.substring(0, hasSearch);
|
||||
}
|
||||
_currentUri = url;
|
||||
_chunked = false;
|
||||
|
||||
HTTPMethod method = HTTP_GET;
|
||||
if (methodStr == "POST") {
|
||||
|
Reference in New Issue
Block a user