-
Notifications
You must be signed in to change notification settings - Fork 17.7k
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
Unsolicited response received on idle HTTP channel… #19895
Comments
This message doesnt appear when I use https:// ( |
Their server is indeed sending that "0\r\n" in response to a HEAD request. That's bogus. See https://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html#sec9.4 The "0\r\n" they're sending is part of the chunked transport encoding of the message body. It should not be present in a HEAD response.
So, Go seems to be doing the correct thing here. I note their server also returns bogus stuff over https (using openssl s_client -connect and typing the same thing). If it worked for you sometimes, maybe their caching is busted and when the response falls out of their cache, then HEAD works, but if a GET happened to them recently, they reply with that response to HEAD responses? Just guessing how they have this bug. But it seems their server is busted. |
I agree that this is a bug of the remote server. But I would then expect to get err != nil as a result of http.Head call. Instead, I got a normal response and an unexpected debug output, and there is nothing about it in the documentation. What if I use another logger in my program? What if my program should not write anything in stderr? There is no way to configure this, we always get a debug output in stderr. Therefore, it seems to me that the behavior of Go net/http in this case is incorrect. If this is an error, it must be in err. Now this message can only be seen with the eyes, but can not be handled in the program. |
Because everything is fine for the Head call. The server's response is exactly what The problem is what happens in-between two requests on the same connection. Go keeps that TCP connection open for your next requests to that server, but after your Head and before you do anything else, then it sees that "0\r\n", not associated with any call of yours, so there's nobody to return an error too. You can change the log output using https://golang.org/pkg/log/#SetOutput if you don't use the standard library logger at all. |
go1.8 windows/amd64
What did you do?
I run this simple program:
What did you expect to see?
A single line with unshorten t.co URL:
What did you see instead?
Some log message before expected output:
The text was updated successfully, but these errors were encountered: