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(client): no keep-alive always returning an error #83

Merged
merged 1 commit into from
Dec 22, 2023

Conversation

dswij
Copy link
Member

@dswij dswij commented Dec 22, 2023

fixes hyperium/hyper#3499

This PR fixes the hyper_util::client::legacy::Client always returning an error without sending any request.

Found while working on #77, test for this will be included in the PR.


After the change, the code in the issue returns

Ok(
    Response {
        status: 200,
        version: HTTP/1.0,
        headers: {
            "server": "SimpleHTTP/0.6 Python/3.11.4",
            "date": "Fri, 22 Dec 2023 13:24:20 GMT",
            "content-type": "text/html; charset=utf-8",
            "content-length": "2204",
        },
        body: Body(
            Streaming,
        ),
    },
)

instead of PoolDisabled error

@seanmonstar
Copy link
Member

Hm, there's this code in the repo already:

            Either::Left((Err(err), connecting)) => {
                if err.is_canceled() {
                    connecting.await.map_err(ClientConnectError::Normal)
                } else {
                    Err(ClientConnectError::Normal(e!(Connect, err)))
                }
            }

Is the problem that the pool disabled error no longer results in err.is_canceled() being true?

@dswij
Copy link
Member Author

dswij commented Dec 22, 2023

Is the problem that the pool disabled error no longer results in err.is_canceled() being true?

Yes.

But doing it this way is kinda confusing. Explicitly selecting one future in this case instead of saying it's canceled is clearer in my opinion.

@seanmonstar
Copy link
Member

Agreed, this is clearer. As long no extra logic that should apply in both cases happens down in the select.

@seanmonstar seanmonstar merged commit 324408b into hyperium:master Dec 22, 2023
15 checks passed
@dswij dswij deleted the hyper-3499 branch December 22, 2023 18:22
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_util::client::legacy::Client always returns an error with no keep-alive
2 participants