mirror of
https://github.com/esp8266/Arduino.git
synced 2025-04-19 23:22:16 +03:00
Protect against server hijacking error handling (#7811)
If a server returns "HTTP/1.x -8 OK", for example, it can misguide an application developer into freeing less-important memory so the request can be retried and succeed, when the problem is in the server. _returnCode is never used anywhere else, but it could still contain a negative value returned by a broken server and therefore could cause troubles in the future (if _returnCode is in fact used)
This commit is contained in:
parent
adbd23b6e2
commit
98a19ab245
@ -1125,18 +1125,18 @@ int HTTPClient::handleHeaderResponse()
|
|||||||
if(transferEncoding.equalsIgnoreCase(F("chunked"))) {
|
if(transferEncoding.equalsIgnoreCase(F("chunked"))) {
|
||||||
_transferEncoding = HTTPC_TE_CHUNKED;
|
_transferEncoding = HTTPC_TE_CHUNKED;
|
||||||
} else {
|
} else {
|
||||||
return HTTPC_ERROR_ENCODING;
|
_returnCode = HTTPC_ERROR_ENCODING;
|
||||||
|
return _returnCode;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
_transferEncoding = HTTPC_TE_IDENTITY;
|
_transferEncoding = HTTPC_TE_IDENTITY;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(_returnCode) {
|
if(_returnCode <= 0) {
|
||||||
return _returnCode;
|
|
||||||
} else {
|
|
||||||
DEBUG_HTTPCLIENT("[HTTP-Client][handleHeaderResponse] Remote host is not an HTTP Server!");
|
DEBUG_HTTPCLIENT("[HTTP-Client][handleHeaderResponse] Remote host is not an HTTP Server!");
|
||||||
return HTTPC_ERROR_NO_HTTP_SERVER;
|
_returnCode = HTTPC_ERROR_NO_HTTP_SERVER;
|
||||||
}
|
}
|
||||||
|
return _returnCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user