@@ -149,18 +149,36 @@ class ESP8266WebServerTemplate
149149 void sendContent (const char *content) { sendContent_P (content); }
150150 void sendContent (const char *content, size_t size) { sendContent_P (content, size); }
151151
152+ bool chunkedResponseModeStart_P (int code, PGM_P content_type) {
153+ if (_currentVersion == 0 )
154+ // no chunk mode in HTTP/1.0
155+ return false ;
156+ setContentLength (CONTENT_LENGTH_UNKNOWN);
157+ send_P (code, content_type, " " );
158+ return true ;
159+ }
160+ bool chunkedResponseModeStart (int code, const char * content_type) {
161+ return chunkedResponseModeStart_P (code, content_type);
162+ }
163+ bool chunkedResponseModeStart (int code, const String& content_type) {
164+ return chunkedResponseModeStart_P (code, content_type.c_str ());
165+ }
166+ void chunkedResponseFinalize () {
167+ sendContent (emptyString);
168+ }
169+
152170 static String credentialHash (const String& username, const String& realm, const String& password);
153171
154172 static String urlDecode (const String& text);
155173
156- // Handle a GET request by sending a response header and stream file content to response body
174+ // Handle a GET request by sending a response header and stream file content to response body
157175 template <typename T>
158176 size_t streamFile (T &file, const String& contentType) {
159177 return streamFile (file, contentType, HTTP_GET);
160178 }
161179
162180 // Implement GET and HEAD requests for files.
163- // Stream body on HTTP_GET but not on HTTP_HEAD requests.
181+ // Stream body on HTTP_GET but not on HTTP_HEAD requests.
164182 template <typename T>
165183 size_t streamFile (T &file, const String& contentType, HTTPMethod requestMethod) {
166184 size_t contentLength = 0 ;
0 commit comments