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

"operation was canceled: received unexpected message from connection" - but why? #2673

Open
bagder opened this issue Oct 22, 2021 · 1 comment
Labels
C-bug Category: bug. Something is wrong. This is bad!

Comments

@bagder
Copy link
Contributor

bagder commented Oct 22, 2021

Version

commit bd6c35b

Platform

Linux 5.14.0-3-amd64 #1 SMP Debian 5.14.12-1 (2021-10-14) x86_64 GNU/Linux

Description

I run curl using hyper as a HTTP backend and I suddenly ran into a problem. I have a test case (206) which makes a CONNECT request to a test server and it gets a 175 bytes response back. The response looks like this:

HTTP/1.1 407 Authorization Required to proxy me my dear
Proxy-Authenticate: Digest realm="weirdorealm", nonce="12345"
Content-Length: 33

And you should ignore this data.

That is: I don't spot any issues, and this works sometimes and it works with libcurl's native HTTP code.

However, hyper often decides to fail on this response. hyper_executor_poll() then returns a task that is HYPER_TASK_ERROR and if I extract the value from that task and then call hyper_error_print() it returns:

operation was canceled: received unexpected message from connection

First: what exactly is the unexpectedness it received? I don't see it in my logs. I don't get it.

Second: "message" ? Did it really receive a message over the connection?

I presume that this issue happens to me because of something I've done wrong in using the API, but I struggle to understand what, a lot because the error message doesn't help me understand the problem.

@bagder bagder added the C-bug Category: bug. Something is wrong. This is bad! label Oct 22, 2021
@bagder
Copy link
Contributor Author

bagder commented Oct 22, 2021

@icing helped me out with this comment (in our IRC channel):

the "unexpected message" seems to be raised when their connection input buffer is not empty. Do you read the body of the 407? Maybe it lingers unconsumed somewhere.

That was indeed a very useful clue. Maybe something like that could've been in the error message?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: bug. Something is wrong. This is bad!
Projects
None yet
Development

No branches or pull requests

1 participant