@@ -188,7 +188,30 @@ HTTPServer::ClientFuture HTTPServer::_parseRequest(WiFiClient* client) {
188188 }
189189 }
190190
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) {
192215 size_t plainLength;
193216 char * plainBuf = readBytesWithTimeout (client, _clientContentLength, plainLength, HTTP_MAX_POST_WAIT);
194217 if ((int )plainLength < (int )_clientContentLength) {
@@ -333,7 +356,7 @@ void HTTPServer::_uploadWriteByte(uint8_t b) {
333356 _currentUpload->buf [_currentUpload->currentSize ++] = b;
334357}
335358
336- int HTTPServer::_uploadReadByte (WiFiClient* client) {
359+ int HTTPServer::_uploadReadByte (WiFiClient * client) {
337360 int res = client->read ();
338361 if (res < 0 ) {
339362 // keep trying until you either read a valid byte or timeout
@@ -376,7 +399,7 @@ int HTTPServer::_uploadReadByte(WiFiClient* client) {
376399 return res;
377400}
378401
379- bool HTTPServer::_parseForm (WiFiClient* client, String boundary, uint32_t len) {
402+ bool HTTPServer::_parseForm (WiFiClient * client, String boundary, uint32_t len) {
380403 (void ) len;
381404 log_v (" Parse Form: Boundary: %s Length: %d" , boundary.c_str (), len);
382405 String line;
@@ -595,7 +618,7 @@ bool HTTPServer::_parseForm(WiFiClient* client, String boundary, uint32_t len) {
595618 return false ;
596619}
597620
598- String HTTPServer::urlDecode (const String& text) {
621+ String HTTPServer::urlDecode (const String & text) {
599622 String decoded = " " ;
600623 char temp[] = " 0x00" ;
601624 unsigned int len = text.length ();
0 commit comments