hyperium / hyper

An HTTP library for Rust
https://hyper.rs
MIT License
14.58k stars 1.6k forks source link

connection error: user body write aborted: early end, expected xxxx more bytes #3738

Closed Lordworms closed 3 weeks ago

Lordworms commented 3 months ago

Version List the version(s) of hyper, and any relevant hyper dependency (such as h2 if this is related to HTTP/2). hyper = { version = "0.14.26", features = ["stream"] } Platform The output of uname -a (UNIX), or version and 32 or 64-bit (Windows) macos

Description Enter your issue details here. One way to structure the description: 2024-08-15T23:22:01.033223Z DEBUG hyper::proto::h1::io: flushed 8192 bytes 2024-08-15T23:22:01.033316Z DEBUG hyper::proto::h1::io: flushed 8192 bytes 2024-08-15T23:22:01.033304Z DEBUG hyper::server::server::new_svc: connection error: user body write aborted: early end, expected 8388608 more bytes hyper::server::server::new_svc: connection error: connection error: Connection reset by peer (os error 54) I was trying to use a stream way to transfer a large file, but got error anyway. the log is above

pub struct S3Response<T> {
    /// Operation output
    pub output: T,

    /// Response headers, overrides the headers in `output`.
    pub headers: HeaderMap<HeaderValue>,

    /// Response extensions.
    ///
    /// It is used to pass custom data between middlewares.
    pub extensions: Extensions,
}

[short summary of the bug]

I tried this code:

[code sample that causes the bug]

I expected to see this happen: [explanation]

Instead, this happened: [explanation]

seanmonstar commented 3 months ago

Do you have any more info? The error message seems rather clear: you said you were going to send NN bytes, but you only sent M.