Repository navigation
Let a single-use connection serve its request when the first stream is not 1 - #33
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes bogdanfinn/tls-client#289, along the lines michal-billtech proposed there.
A request with
Connection: closegets a single-use connection.idleStateLockedcounted that connection as spent oncenextStreamID > 1, which assumes the first stream is 1. In fhttp it is not always:InitialStreamID,AllowHTTPandPrioritiesall movenextStreamIDinnewClientConn, before any request. So a fresh single-use connection reported that it could not take a request,RoundTripgoterrClientConnUnusable, and the transport dialed a new connection, again and again. Firefox profiles start at stream 3, so this hits every one of them.newClientConnnow records where the connection starts (firstStreamID), and both checks inidleStateLockedcompare against that instead of 1.TestSingleUseConnServesItsRequestWhenTheFirstStreamIsNotOneruns four cases against a local HTTP/2 server and counts the connections the server sees:Connection: close, andInitialStreamID3 without it. Both pass on master too, they are the controlsInitialStreamID3 withConnection: close. On master: no response after 5s, 4 connections dialedPrioritieswithConnection: close. Same on masterEach case must get a response over exactly one connection. Reverting either the comparison or the assignment fails the test.
The
freshConnchange only matters for the GetConn trace hook when the transport comes fromConfigureTransport. The test does not cover it, but it rests on the same assumption, so I changed it too.go test ./...on Windows: the same 8 failures on master and on this branch (ServeFile, ServeContent, OmitHTTP2, cgi DirWindows), and none of them are in http2../http2passes, also with-race.