net/http: make Transport use new connection if over HTTP/2 concurrency limit
net/http: make Transport use new connection if over HTTP/2 concurrency limit

The Go HTTP/1 client will make as many new TCP connections as the user requests.

The HTTP/2 client tried to have that behavior, but the policy of
whether a connection is re-usable didn't take into account the extra 1
stream counting against SETTINGS_MAX_CONCURRENT_STREAMS so in practice
users were getting errors.

For example, if the server's advertised max concurrent streams is 100
and 200 concurrrent Go HTTP requests ask for a connection at once, all
200 will think they can reuse that TCP connection, but then 100 will
fail later when the number of concurrent streams exceeds 100.

Instead, recognize the "no cached connections" error value in the
shouldRetryRequest method, so those 100 will retry a new connection.

This is the conservative fix for Go 1.7 so users don't get errors, and
to match the HTTP/1 behavior. Issues #13957 and #13774 are the more
involved bugs for Go 1.8.

Updates #16582
Updates #13957

Change-Id: I1f15a7ce60c07a4baebca87675836d6fe03993e8
Reviewed-on: https://go-review.googlesource.com/25580
TryBot-Result: Gobot Gobot <66cb808b70d30c07676d5e946fee83fd561249e5@golang.org>
Reviewed-by: Ian Lance Taylor <87e9c6d529889242b7e184afb632328636553ab4@golang.org>
Reviewed-by: Chris Broadfoot <0c2851a4f8ab4aa5606e69c0757771dd13dbe686@golang.org>
Run-TryBot: Brad Fitzpatrick <ae9783c0b0efc69cd85ab025ddd17aa44cdc4aa5@golang.org>

Cofyc/go,linux-on-ibm-z/go,codestation/go,CAFxX/go,derekmarcotte/go,akutz/go,akutz/go,CAFxX/go,golang/go,cloudflare/go,josharian/go,codestation/go,momchil-velikov/go,golang/go,Cofyc/go,golang/go,nawawi/go,4ad/go,momchil-velikov/go,goodlang/good,momchil-velikov/go,vsekhar/elastic-go,nawawi/go,derekmarcotte/go,akutz/go,momchil-velikov/go,josharian/go,goodlang/good,josharian/go,vsekhar/elastic-go,vsekhar/elastic-go,josharian/go,CAFxX/go,4ad/go,cloudflare/go,derekmarcotte/go,momchil-velikov/go,polyverse-security/go,suncycheng/go,josharian/go,polyverse-security/go,CAFxX/go,codestation/go,suncycheng/go,linux-on-ibm-z/go,nawawi/go,golang/go,Cofyc/go,golang/go,akutz/go,goodlang/good,suncycheng/go,vsekhar/elastic-go,goodlang/good,CAFxX/go,4ad/go,akutz/go,polyverse-security/go,Cofyc/go,suncycheng/go,derekmarcotte/go,linux-on-ibm-z/go,derekmarcotte/go,golang/go,vsekhar/elastic-go,ImJasonH/go,polyverse-security/go,golang/go,Cofyc/go,codestation/go,josharian/go,nawawi/go,CAFxX/go,goodlang/good,suncycheng/go,momchil-velikov/go,codestation/go,vsekhar/elastic-go,ImJasonH/go,Cofyc/go,vsekhar/elastic-go,cloudflare/go,linux-on-ibm-z/go,ImJasonH/go,ImJasonH/go,suncycheng/go,cloudflare/go,4ad/go,goodlang/good,codestation/go,golang/go,CAFxX/go,4ad/go,cloudflare/go,4ad/go,akutz/go,polyverse-security/go,derekmarcotte/go,linux-on-ibm-z/go,linux-on-ibm-z/go,derekmarcotte/go,polyverse-security/go,goodlang/good,vsekhar/elastic-go,suncycheng/go,goodlang/good,akutz/go,josharian/go,4ad/go,4ad/go,momchil-velikov/go,polyverse-security/go,nawawi/go,nawawi/go,codestation/go,cloudflare/go,josharian/go,CAFxX/go,akutz/go,derekmarcotte/go,ImJasonH/go,Cofyc/go,nawawi/go,nawawi/go,momchil-velikov/go,cloudflare/go,cloudflare/go,Cofyc/go,suncycheng/go,ImJasonH/go,linux-on-ibm-z/go,ImJasonH/go,codestation/go,ImJasonH/go,linux-on-ibm-z/go,christopher-henderson/Go,polyverse-security/go