Skip to content

InvalidInput when decoding manifest due to HTTP 1.1 call #131

@sschueller

Description

@sschueller
  • 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions