mirror of
https://github.com/esp8266/Arduino.git
synced 2025-06-28 05:01:28 +03:00
Expose webserver's chunk api (#7134)
* expose hidden WebServer's chunked API
This commit is contained in:
@ -149,18 +149,36 @@ public:
|
||||
void sendContent(const char *content) { sendContent_P(content); }
|
||||
void sendContent(const char *content, size_t size) { sendContent_P(content, size); }
|
||||
|
||||
bool chunkedResponseModeStart_P (int code, PGM_P content_type) {
|
||||
if (_currentVersion == 0)
|
||||
// no chunk mode in HTTP/1.0
|
||||
return false;
|
||||
setContentLength(CONTENT_LENGTH_UNKNOWN);
|
||||
send_P(code, content_type, "");
|
||||
return true;
|
||||
}
|
||||
bool chunkedResponseModeStart (int code, const char* content_type) {
|
||||
return chunkedResponseModeStart_P(code, content_type);
|
||||
}
|
||||
bool chunkedResponseModeStart (int code, const String& content_type) {
|
||||
return chunkedResponseModeStart_P(code, content_type.c_str());
|
||||
}
|
||||
void chunkedResponseFinalize () {
|
||||
sendContent(emptyString);
|
||||
}
|
||||
|
||||
static String credentialHash(const String& username, const String& realm, const String& password);
|
||||
|
||||
static String urlDecode(const String& text);
|
||||
|
||||
// Handle a GET request by sending a response header and stream file content to response body
|
||||
// Handle a GET request by sending a response header and stream file content to response body
|
||||
template<typename T>
|
||||
size_t streamFile(T &file, const String& contentType) {
|
||||
return streamFile(file, contentType, HTTP_GET);
|
||||
}
|
||||
|
||||
// Implement GET and HEAD requests for files.
|
||||
// Stream body on HTTP_GET but not on HTTP_HEAD requests.
|
||||
// Stream body on HTTP_GET but not on HTTP_HEAD requests.
|
||||
template<typename T>
|
||||
size_t streamFile(T &file, const String& contentType, HTTPMethod requestMethod) {
|
||||
size_t contentLength = 0;
|
||||
|
Reference in New Issue
Block a user