Repository: go
Issue: x/net/http2: Transport ignores net/http.Transport.Proxy once connected
Labels: NeedsFix

### 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`)?
```
GOARCH="amd64"
GOBIN=""
GOCACHE="..."
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="..."
GORACE=""
GOROOT="/usr/local/Cellar/go/1.10.2/libexec"
GOTMPDIR=""
GOTOOLDIR="/usr/local/Cellar/go/1.10.2/libexec/pkg/tool/darwin_amd64"
GCCGO="gccgo"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/_j/6wqhr8r57g34l96w0vt17bww0000gp/T/go-build671837991=/tmp/go-build -gno-record-gcc-switches -fno-common"
```

### What did you do?
I've set up an HTTP2 client and server. The client does a few concurrent requests to the sever. The client's http.Transport has a Proxy function set which alters the requests's context. The http.Transport.DisableKeepAlives flag is also set to true.

Upon receiving the response, the contents of the context gets printed out.
My code in playground: https://play.golang.org/p/bx4GvEZ-suw
Can't be run in playground though, because of the HTTP/2 package and needed cert and key.
To get the cert + key run: `openssl req -x509 -newkey rsa:4096 -keyout server.key -out server.pem -days 365 -nodes` in the directory of the file.


### What did you expect to see?
The context of every request altered, like so: (what happens if the http.Transport doesn't get configured for HTTP2)
```
context.Background.WithValue("Proxy", 1)
context.Background.WithValue("Proxy", 1)
context.Background.WithValue("Proxy", 1)
context.Background.WithValue("Proxy", 1)
context.Background.WithValue("Proxy", 1)
context.Background.WithValue("Proxy", 1)
context.Background.WithValue("Proxy", 1)
context.Background.WithValue("Proxy", 1)
context.Background.WithValue("Proxy", 1)
context.Background.WithValue("Proxy", 1)
context.Background.WithValue("Proxy", 1)
context.Background.WithValue("Proxy", 1)
context.Background.WithValue("Proxy", 1)
context.Background.WithValue("Proxy", 1)
context.Background.WithValue("Proxy", 1)
context.Background.WithValue("Proxy", 1)
context.Background.WithValue("Proxy", 1)
context.Background.WithValue("Proxy", 1)
context.Background.WithValue("Proxy", 1)
context.Background.WithValue("Proxy", 1)
```

### What did you see instead?
Almost none of the requests passed through the http.Transport.Proxy function, even though the no keepalives flag has been set:

```
context.Background.WithValue("Proxy", 1)
context.Background
context.Background.WithValue("Proxy", 1)
context.Background
context.Background
context.Background
context.Background
context.Background
context.Background
context.Background
context.Background
context.Background
context.Background
context.Background
context.Background
context.Background
context.Background
context.Background
context.Background
context.Background
```

Not using HTTP2 on the client side seems to solve the issue completely. Playing with the 10ms processing time on the server and 10ms waiting time between starting goroutines either resolves the issue or make it worse. However this is not something you (should) have control over in a production environment.

This might be related to: https://github.com/golang/go/issues/25620, however that one is on TCP level (where the http.Transport.Proxy is called, but not respected), while here the function isn't called at all.