hyper
hyper copied to clipboard
"operation was canceled: received unexpected message from connection" - but why?
Version
commit bd6c35b98f9513f14ed9cecad933bc7fdb8635ea
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.
@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?