mirror of
https://github.com/esp8266/Arduino.git
synced 2025-04-19 23:22:16 +03:00
Added naive content length to upload struct (#5142)
Content length provides context into the size of the upload, it's not the exact form body size it's off by the request header info, but it was already parsed by the library and provides little to no additional overhead to pass on for use in request handlers.
This commit is contained in:
parent
1fb9b4e0ee
commit
8f28c88f9c
@ -55,8 +55,9 @@ typedef struct {
|
|||||||
String filename;
|
String filename;
|
||||||
String name;
|
String name;
|
||||||
String type;
|
String type;
|
||||||
size_t totalSize; // file size
|
size_t totalSize; // total size of uploaded file so far
|
||||||
size_t currentSize; // size of data currently in buf
|
size_t currentSize; // size of data currently in buf
|
||||||
|
size_t contentLength; // size of entire post request, file size + headers and other request data.
|
||||||
uint8_t buf[HTTP_UPLOAD_BUFLEN];
|
uint8_t buf[HTTP_UPLOAD_BUFLEN];
|
||||||
} HTTPUpload;
|
} HTTPUpload;
|
||||||
|
|
||||||
|
@ -468,6 +468,7 @@ bool ESP8266WebServer::_parseForm(WiFiClient& client, const String& boundary, ui
|
|||||||
_currentUpload->type = argType;
|
_currentUpload->type = argType;
|
||||||
_currentUpload->totalSize = 0;
|
_currentUpload->totalSize = 0;
|
||||||
_currentUpload->currentSize = 0;
|
_currentUpload->currentSize = 0;
|
||||||
|
_currentUpload->contentLength = len;
|
||||||
#ifdef DEBUG_ESP_HTTP_SERVER
|
#ifdef DEBUG_ESP_HTTP_SERVER
|
||||||
DEBUG_OUTPUT.print("Start File: ");
|
DEBUG_OUTPUT.print("Start File: ");
|
||||||
DEBUG_OUTPUT.print(_currentUpload->filename);
|
DEBUG_OUTPUT.print(_currentUpload->filename);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user