@@ -188,7 +188,30 @@ HTTPServer::ClientFuture HTTPServer::_parseRequest(WiFiClient* client) {
188
188
}
189
189
}
190
190
191
- if (!isForm) {
191
+ if (!isForm && _currentHandler && _currentHandler->canRaw (_currentUri)) {
192
+ log_v (" Parse raw" );
193
+ _currentRaw.reset (new HTTPRaw ());
194
+ _currentRaw->status = RAW_START;
195
+ _currentRaw->totalSize = 0 ;
196
+ _currentRaw->currentSize = 0 ;
197
+ log_v (" Start Raw" );
198
+ _currentHandler->raw (*this , _currentUri, *_currentRaw);
199
+ _currentRaw->status = RAW_WRITE;
200
+
201
+ while (_currentRaw->totalSize < (size_t )_clientContentLength) {
202
+ _currentRaw->currentSize = client->readBytes (_currentRaw->buf , HTTP_RAW_BUFLEN);
203
+ _currentRaw->totalSize += _currentRaw->currentSize ;
204
+ if (_currentRaw->currentSize == 0 ) {
205
+ _currentRaw->status = RAW_ABORTED;
206
+ _currentHandler->raw (*this , _currentUri, *_currentRaw);
207
+ return CLIENT_MUST_STOP;
208
+ }
209
+ _currentHandler->raw (*this , _currentUri, *_currentRaw);
210
+ }
211
+ _currentRaw->status = RAW_END;
212
+ _currentHandler->raw (*this , _currentUri, *_currentRaw);
213
+ log_v (" Finish Raw" );
214
+ } else if (!isForm) {
192
215
size_t plainLength;
193
216
char * plainBuf = readBytesWithTimeout (client, _clientContentLength, plainLength, HTTP_MAX_POST_WAIT);
194
217
if ((int )plainLength < (int )_clientContentLength) {
@@ -333,7 +356,7 @@ void HTTPServer::_uploadWriteByte(uint8_t b) {
333
356
_currentUpload->buf [_currentUpload->currentSize ++] = b;
334
357
}
335
358
336
- int HTTPServer::_uploadReadByte (WiFiClient* client) {
359
+ int HTTPServer::_uploadReadByte (WiFiClient * client) {
337
360
int res = client->read ();
338
361
if (res < 0 ) {
339
362
// keep trying until you either read a valid byte or timeout
@@ -376,7 +399,7 @@ int HTTPServer::_uploadReadByte(WiFiClient* client) {
376
399
return res;
377
400
}
378
401
379
- bool HTTPServer::_parseForm (WiFiClient* client, String boundary, uint32_t len) {
402
+ bool HTTPServer::_parseForm (WiFiClient * client, String boundary, uint32_t len) {
380
403
(void ) len;
381
404
log_v (" Parse Form: Boundary: %s Length: %d" , boundary.c_str (), len);
382
405
String line;
@@ -595,7 +618,7 @@ bool HTTPServer::_parseForm(WiFiClient* client, String boundary, uint32_t len) {
595
618
return false ;
596
619
}
597
620
598
- String HTTPServer::urlDecode (const String& text) {
621
+ String HTTPServer::urlDecode (const String & text) {
599
622
String decoded = " " ;
600
623
char temp[] = " 0x00" ;
601
624
unsigned int len = text.length ();
0 commit comments