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

fix(http1): is_timeout works on HeaderTimeout #3781

Closed
wants to merge 3 commits into from

Conversation

T-aian
Copy link

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

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
Member

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

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
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 <[email protected]>
Co-authored-by: Finn Bear <[email protected]>
Co-authored-by: tottoto <[email protected]>
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

Successfully merging this pull request may close these issues.

hyper::Error::is_timeout returns false on a HeaderTimeout.
2 participants