x/net/http2: Transport Proxy field isn't always respected on TCP level #25620
Labels
FrozenDueToAge
NeedsInvestigation
Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone
What version of Go are you using (
go version
)?go1.10.2 darwin/amd64
Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (
go env
)?What did you do?
I build an HTTP/2.0 server and 2 TCP proxy servers. Then I executed 20 concurrent requests (with an HTTP/2.0 transport) to the server, alternating the proxy servers to go through. The transport has been configured to disable keepalives.
The server prints out the http.Request.RemoteAddress of the request and it's ID. (The ID determines which proxy server should be selected: odd or even number). So we can see if a connection has been reused or not.
The code can be found here: https://play.golang.org/p/MNtzLK0KX_T
However it won't run in the playground, since the
"golang.org/x/net/http2"
package is used.What did you expect to see?
When commenting out the http2.ConfigureTransport, the output becomes:
Which means every request was done through it's own connection. Nothing has been reused. This was what I expected to see for HTTP/2.0 as well.
What did you see instead?
This is the output of the program:
Some of these requests have been handled by the same connection. E.g. requests with ID 10 and 19, and requests with ID 2 and 15 have been send through the same remote address, which means they used the same proxy server as well, even though the odd ID's should use a different proxy server from the even ID's.
So even though a proxy server was assigned on HTTP level, through the http.Transport.Proxy, it isn't always respected on TCP level, since a previous connection gets reused.
EDIT @vagruchi pointed out an issue with the previous version of the issue, where the proxy server wasn't actually used. This has been fixed in the current implementation and the output has been updated.
The text was updated successfully, but these errors were encountered: