Skip to content

fix(http1): is_timeout works on HeaderTimeout#3781

Closed
T-aian wants to merge 3 commits into
hyperium:masterfrom
T-aian:master
Closed

fix(http1): is_timeout works on HeaderTimeout#3781
T-aian wants to merge 3 commits into
hyperium:masterfrom
T-aian:master

Conversation

@T-aian

@T-aian T-aian commented Nov 10, 2024

Copy link
Copy Markdown

Changed hyper::Error::is_timeout() to also check if the kind of the error is a HeaderTimeout. I also added a test at the end of server.rs to check for this kind of timeout error.

Fixes #3780

@seanmonstar

Copy link
Copy Markdown
Member

Thanks for the PR! Looks like rustfmt is grumpy. rustfmt --edition 2021 $(git ls-files '*.rs') should fix it up.

Comment thread src/error.rs
return matches!(self.inner.kind, Kind::HeaderTimeout)
|| self.find_source::<TimedOut>().is_some();

#[cfg(not(any(all(feature = "http1", feature = "server"), feature = "ffi")))]

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like the feature flag combinations are tricky. Here's what I'd suggest:

#[cfg(all(feature = "http1", feature = "server"))]
if matches!(self.inner.kind, Kind::HeaderTimeout) {
    return true;
}

self.find_source::<TimedOut>().is_some()
GlenDC added a commit to plabayo/rama that referenced this pull request Feb 20, 2025
- ext: add ext::on_informational() callback extension
  (<hyperium/hyper#3818>)
  (<hyperium/hyper@8ce1fcf>,
    closes <hyperium/hyper#2565>)
- server: add http1::Builder::ignore_invalid_headers(bool) option
  (<hyperium/hyper#3824>)
  (<hyperium/hyper@3817a79>)

- server:
    - start http1 header read timeout when conn is idle
      (<hyperium/hyper#3828>)
      (<hyperium/hyper@10b09ff>,
        closes <hyperium/hyper#3780>,
          <hyperium/hyper#3781>)
    - change max_local_error_reset_streams function to &mut self (#3820) (e981a91e)

- http2::Builder::max_local_error_reset_streams() now takes
  &mut self and returns &mut Self. In practice, this shouldn't break almost anyone.
  It was the wrong receiver and return types.
  (<hyperium/hyper@e981a91>)

Co-authored-by: Sean McArthur <sean@seanmonstar.com>
Co-authored-by: Finn Bear <finnbearlabs@gmail.com>
Co-authored-by: tottoto <tottotodev@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants