@@ -44,9 +44,8 @@ static bool readBytesWithTimeout(typename ServerType::ClientType& client, size_t
44
44
template <typename ServerType>
45
45
typename ESP8266WebServerTemplate<ServerType>::ClientFuture ESP8266WebServerTemplate<ServerType>::_parseRequest(ClientType& client) {
46
46
// Read the first line of HTTP request
47
- String req = client.readStringUntil (' \r ' );
47
+ String req = client.readStringUntil (" \r\n " );
48
48
DBGWS (" request: %s\n " , req.c_str ());
49
- client.readStringUntil (' \n ' );
50
49
// reset header value
51
50
for (int i = 0 ; i < _headerKeysCount; ++i) {
52
51
_currentHeaders[i].value .clear ();
@@ -122,8 +121,7 @@ typename ESP8266WebServerTemplate<ServerType>::ClientFuture ESP8266WebServerTemp
122
121
uint32_t contentLength = 0 ;
123
122
// parse headers
124
123
while (1 ){
125
- req = client.readStringUntil (' \r ' );
126
- client.readStringUntil (' \n ' );
124
+ req = client.readStringUntil (" \r\n " );
127
125
if (req.isEmpty ()) break ; // no more headers
128
126
int headerDiv = req.indexOf (' :' );
129
127
if (headerDiv == -1 ){
@@ -198,8 +196,7 @@ typename ESP8266WebServerTemplate<ServerType>::ClientFuture ESP8266WebServerTemp
198
196
String headerValue;
199
197
// parse headers
200
198
while (1 ){
201
- req = client.readStringUntil (' \r ' );
202
- client.readStringUntil (' \n ' );
199
+ req = client.readStringUntil (" \r\n " );
203
200
if (req.isEmpty ()) break ;// no moar headers
204
201
int headerDiv = req.indexOf (' :' );
205
202
if (headerDiv == -1 ){
@@ -351,7 +348,7 @@ bool ESP8266WebServerTemplate<ServerType>::_parseForm(ClientType& client, const
351
348
String line;
352
349
int retry = 0 ;
353
350
do {
354
- line = client.readStringUntil (' \r ' );
351
+ line = client.readStringUntil (" \r\n " );
355
352
++retry;
356
353
} while (line.length () == 0 && retry < 3 );
357
354
@@ -367,8 +364,7 @@ bool ESP8266WebServerTemplate<ServerType>::_parseForm(ClientType& client, const
367
364
String argFilename;
368
365
bool argIsFile = false ;
369
366
370
- line = client.readStringUntil (' \r ' );
371
- client.readStringUntil (' \n ' );
367
+ line = client.readStringUntil (" \r\n " );
372
368
if (line.length () > 19 && line.substring (0 , 19 ).equalsIgnoreCase (F (" Content-Disposition" ))){
373
369
int nameStart = line.indexOf (' =' );
374
370
if (nameStart != -1 ){
@@ -388,19 +384,16 @@ bool ESP8266WebServerTemplate<ServerType>::_parseForm(ClientType& client, const
388
384
DBGWS (" PostArg Name: %s\n " , argName.c_str ());
389
385
using namespace mime ;
390
386
argType = FPSTR (mimeTable[txt].mimeType );
391
- line = client.readStringUntil (' \r ' );
392
- client.readStringUntil (' \n ' );
387
+ line = client.readStringUntil (" \r\n " );
393
388
if (line.length () > 12 && line.substring (0 , 12 ).equalsIgnoreCase (FPSTR (Content_Type))){
394
389
argType = line.substring (line.indexOf (' :' )+2 );
395
390
// skip next line
396
- client.readStringUntil (' \r ' );
397
- client.readStringUntil (' \n ' );
391
+ client.readStringUntil (" \r\n " );
398
392
}
399
393
DBGWS (" PostArg Type: %s\n " , argType.c_str ());
400
394
if (!argIsFile){
401
395
while (1 ){
402
- line = client.readStringUntil (' \r ' );
403
- client.readStringUntil (' \n ' );
396
+ line = client.readStringUntil (" \r\n " );
404
397
if (line.startsWith (" --" +boundary)) break ;
405
398
if (argValue.length () > 0 ) argValue += ' \n ' ;
406
399
argValue += line;
@@ -474,8 +467,7 @@ bool ESP8266WebServerTemplate<ServerType>::_parseForm(ClientType& client, const
474
467
_currentUpload->type .c_str (),
475
468
(int )_currentUpload->totalSize );
476
469
if (!client.connected ()) return _parseFormUploadAborted ();
477
- line = client.readStringUntil (' \r ' );
478
- client.readStringUntil (' \n ' );
470
+ line = client.readStringUntil (" \r\n " );
479
471
if (line == " --" ) { // extra two dashes mean we reached the end of all form fields
480
472
DBGWS (" Done Parsing POST\n " );
481
473
break ;
0 commit comments