Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bumped send_file() to HTTP/1.1, added missing zero-length chunk at the end #1

merged 1 commit into from Jul 16, 2021


Copy link

I was playing around with this on my ESP32 and curl was giving output like this:

[virtualwolf@twee:~]$ curl -v http://indoor/log
*   Trying
* Connected to indoor ( port 80 (#0)
> GET /log HTTP/1.1
> Host: indoor
> User-Agent: curl/7.64.1
> Accept: */*
< HTTP/1.0 200 OK
< Content-Type: text/html
< Content-Length: 283
< Accept-Ranges: none
< Transfer-Encoding: chunked
[content of the file it's loading, snipped for brevity]
* Illegal or missing hexadecimal sequence in chunked-encoding
* Closing connection 0
curl: (56) Illegal or missing hexadecimal sequence in chunked-encoding

It turns out there were two issues, one is that chunked encoding is available in HTTP/1.1, not 1.0, and it requires a final zero-length chunk to indicate there's no more.

(As an aside, thanks so much for this repo, it's been invaluable in getting my head around how to use uasyncio to create a super-basic HTTP server!)

Copy link

marcidy commented Jul 16, 2021

Thanks! Nice catch, appreciate the fix!

@marcidy marcidy merged commit 0da5bee into marcidy:main Jul 16, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
None yet

Successfully merging this pull request may close these issues.

None yet

2 participants