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

Open
wants to merge 3 commits into
base: master
Choose a base branch
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()

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