Closed sschueller closed 1 month ago
Here is a work around for anyone wanting to use Symphony php framework to serve the updates:
In your Controller:
// remove chunked to support arduino http 1.0
$response = (new JsonResponse(json_encode($listOfFirmwaresArray, (JSON_UNESCAPED_SLASHES)), 200, [], true));
$response->headers->remove('Transfer-Encoding');
$response->headers->set('Content-Length', strlen($response->getContent()));
return $response;
Arduino board: esp32-s3-devkitc-1
Arduino IDE version (found in Arduino -> About Arduino menu): Platform IO Core 6.1.7
List the steps to reproduce the problem below (if possible attach a sketch or copy the sketch code in too):
Returning the json manifest from my web server running a fairly new nginx version I get "InvalidInput" when decoding the json with a length of -1.
This appears to be due to https://arduinojson.org/v6/how-to/use-arduinojson-with-httpclient/#how-to-parse-a-json-document-from-an-http-response
"Unfortunately, by using the underlying Stream, we bypass the code that handles chunked transfer encoding, so we must switch to HTTP version 1.0."
Sniffing the traffic, the response is indeed "HTTP 1.1" and
_http.getStream()
returns empty while_http.getString()
does not.When I add
_http.useHTTP10(true);
as mentioned in the arduniojson docs before the_http.GET()
, the call is "HTTP 1.0" and the manifest can be decoded. However this does disable chunked transfers.Can
_http.useHTTP10(true);
be added for calls to the manifest? Alternatively one could use the_http.getString();
but this is only ok for very small jsons.