You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A-http1Area: HTTP/1 specific.C-bugCategory: bug. Something is wrong. This is bad!E-easyEffort: easy. A task that would be a great starting point for a new contributor.
When sending a streaming request (using Body::channel) without content-length, the request terminates when dropping the Sender. But when a content-length is set, dropping the Sender before all bytes are sent will result in a request being stuck.
use hyper::{self,Body};#[tokio::main]asyncfnmain(){let(tx, body) = Body::channel();let req = hyper::Request::builder().uri("http://httpbin.org/post").method(hyper::Method::POST).header("content-length",1337).body(body).unwrap();let client = hyper::Client::new();
std::mem::drop(tx);println!("Sending request...");let res = client.request(req).await.unwrap();println!("Response: {:?}", res);}
The example above will terminate when the content-length header is removed, but like this it hangs until the server closes the connection.
On the other hand, when explicitly aborting the sender using tx.abort(), the request will terminate with an error.
The text was updated successfully, but these errors were encountered:
Currently the writing state just gets closed, here. Instead, end_body should probably be changed to return a crate::Result<()>, and that case should return an error that will shutdown the connection.
seanmonstar
added
A-http1
Area: HTTP/1 specific.
E-easy
Effort: easy. A task that would be a great starting point for a new contributor.
C-bug
Category: bug. Something is wrong. This is bad!
labels
Aug 6, 2020
jxs
added a commit
to jxs/hyper
that referenced
this issue
Aug 10, 2020
- update proto::h1::end_body to return Result<()>
- update Encoder::end to return Error(NotEof) only when there's Content-length left to be addressed
Closeshyperium#2263
A-http1Area: HTTP/1 specific.C-bugCategory: bug. Something is wrong. This is bad!E-easyEffort: easy. A task that would be a great starting point for a new contributor.
When sending a streaming request (using
Body::channel
) without content-length, the request terminates when dropping theSender
. But when a content-length is set, dropping theSender
before all bytes are sent will result in a request being stuck.The example above will terminate when the content-length header is removed, but like this it hangs until the server closes the connection.
On the other hand, when explicitly aborting the sender using
tx.abort()
, the request will terminate with an error.The text was updated successfully, but these errors were encountered: