File tree Expand file tree Collapse file tree 1 file changed +4
-3
lines changed
libraries/ESP8266HTTPClient/src Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Original file line number Diff line number Diff line change @@ -1351,9 +1351,10 @@ int HTTPClient::handleHeaderResponse()
1351
1351
1352
1352
if (headerLine.startsWith (F (" HTTP/1." ))) {
1353
1353
1354
- _canReuse = _canReuse && (headerLine[sizeof " HTTP/1." - 1 ] != ' 0' );
1355
- _returnCode = headerLine.substring (9 , headerLine.indexOf (' ' , 9 )).toInt ();
1356
- _canReuse = _canReuse && (_returnCode != ' 0' );
1354
+ constexpr auto httpVersionIdx = sizeof " HTTP/1." - 1 ;
1355
+ _canReuse = _canReuse && (headerLine[httpVersionIdx] != ' 0' );
1356
+ _returnCode = headerLine.substring (httpVersionIdx + 2 , headerLine.indexOf (' ' , httpVersionIdx + 2 )).toInt ();
1357
+ _canReuse = _canReuse && (_returnCode > 0 ) && (_returnCode < 500 );
1357
1358
1358
1359
} else if ((headerSeparator = headerLine.indexOf (' :' )) > 0 ) {
1359
1360
String headerName = headerLine.substring (0 , headerSeparator);
You can’t perform that action at this time.
0 commit comments