mirror of
https://github.com/esp8266/Arduino.git
synced 2025-06-28 05:01:28 +03:00
Rewrite multipart boundary detection (#7728)
Use a simpler, cleaner implementation of multipart form detection as defined in https://tools.ietf.org/html/rfc7578 . Implements a simple state machine that detects the `\r\n--<boundary>` stream in input a character at a time, instead of buffering and comparing in chunks which can miss things due to alignment issues and which also had a problem with replacing characters in a binary stream. Adjust the private _uploadReadByte function to return -1 on error (like a read()), and the main file upload handler to use that return value instead of duplicating logic. Fixes #7723
This commit is contained in:
committed by
GitHub
parent
04b0c270e4
commit
92175d7090
@ -246,7 +246,7 @@ protected:
|
||||
bool _parseForm(ClientType& client, const String& boundary, uint32_t len);
|
||||
bool _parseFormUploadAborted();
|
||||
void _uploadWriteByte(uint8_t b);
|
||||
uint8_t _uploadReadByte(ClientType& client);
|
||||
int _uploadReadByte(ClientType& client);
|
||||
void _prepareHeader(String& response, int code, const char* content_type, size_t contentLength);
|
||||
bool _collectHeader(const char* headerName, const char* headerValue);
|
||||
|
||||
|
Reference in New Issue
Block a user