Skip to content
This repository was archived by the owner on Jan 20, 2025. It is now read-only.

Chunked Response broken on Safar/iOS#1436

Merged
me-no-dev merged 1 commit intome-no-dev:masterfrom
dl9rdz:master
Oct 25, 2024
Merged

Chunked Response broken on Safar/iOS#1436
me-no-dev merged 1 commit intome-no-dev:masterfrom
dl9rdz:master

Conversation

@dl9rdz
Copy link
Copy Markdown
Contributor

@dl9rdz dl9rdz commented Oct 2, 2024

Chunked responses cause Safari on iOS 18 to display "Safari can't open the page. The error was "cannot parse response"".

The reason is that the handling of chunked response is not standard conforming in the current implementation. In contrast to a comment in the source code, the standard (RFC2616) does not allow spaces between the chunk size and the crlf. Most other browsers are more tolerant in this regard, but not Safari on iOS.

There is an easy fix: As also stated in the existing comment, leading zeros are standard compliant. So it is possible to generate an equivalent, standard compliant chunked encoding that is also correctly handled by iOS by extending the size prefix not with spaces at the end, but with leading zeros.

@Sojourneer
Copy link
Copy Markdown

Sojourneer commented Nov 27, 2024

I'm getting the same problem with node.js http-proxy at proxying the POST /settings/leds:
=> Illegal character in chunk size.
which seems to be coming from node.js' http_client, and is caused by a trailing space.

node:http and curl also complained about the suggested solution of leading spaces. So I changed the format to "%04x" to use leading zeros, and that seems to have solved my problem.

Sojourneer added a commit to Sojourneer/ESPAsyncWebServer that referenced this pull request Nov 27, 2024
Sojourneer referenced this pull request in Aircoookie/ESPAsyncWebServer Nov 28, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants