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

hyper server refuses body without Content-Length or Transfer-Encoding: chunked #1842

Closed
mdonoughe opened this issue Jul 5, 2019 · 3 comments

Comments

@mdonoughe
Copy link

mdonoughe commented Jul 5, 2019

This is used for Icecast streaming, where the client just opens the connection, sends the header, then just sends data until the connection is closed. You can reproduce the problem with curl using curl -X PUT http://localhost:5000/stream -d test -H 'Content-Length:'.

You'll get a message [2019-07-05T20:50:55Z DEBUG hyper::proto::h1::conn] parse error (connection closed before message completed) with 4 bytes written to the logger as hyper discards the request body.

I don't know if this is something hyper should support. Obviously if the client can't signal to the server that it is done sending data then the server can't send a response, or it needs to send the response before it has received the entire request body.

@seanmonstar
Copy link
Member

This is required by RFC 7230. If a request doesn't have a Transfer-Encoding: chunked or Content-Length header, then:

  1. If this is a request message and none of the above are true, then the message body length is zero (no message body is present).

@LeviSchuck
Copy link

@mdonoughe according to https://gist.github.com/ePirat/adc3b8ba00d85b7e3870 Transfer encoding chunked is expected

@mdonoughe
Copy link
Author

Only the new protocol uses transfer encoding chunked. Older clients just send an infinite body.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants