powermeter refactor: use HTTP1.0
avoid problems with chunked transfer encoding when using the client's stream to parse a JSON document. fixes the HTTP+JSON power meter to work with shelly and hichi (Tasmota).
This commit is contained in:
parent
15b6a32b92
commit
db869a1144
@ -101,6 +101,11 @@ HttpRequestResult HttpGetter::performGetRequest()
|
|||||||
}
|
}
|
||||||
|
|
||||||
auto upTmpHttpClient = std::make_unique<HTTPClient>();
|
auto upTmpHttpClient = std::make_unique<HTTPClient>();
|
||||||
|
|
||||||
|
// use HTTP1.0 to avoid problems with chunked transfer encoding when the
|
||||||
|
// stream is later used to read the server's response.
|
||||||
|
upTmpHttpClient->useHTTP10(true);
|
||||||
|
|
||||||
if (!upTmpHttpClient->begin(*_spWiFiClient, ipaddr.toString(), _port, _uri, _useHttps)) {
|
if (!upTmpHttpClient->begin(*_spWiFiClient, ipaddr.toString(), _port, _uri, _useHttps)) {
|
||||||
logError("HTTP client begin() failed for %s://%s",
|
logError("HTTP client begin() failed for %s://%s",
|
||||||
(_useHttps ? "https" : "http"), _host.c_str());
|
(_useHttps ? "https" : "http"), _host.c_str());
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user