Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 3c859a7

Browse files
committedMay 28, 2024··
check if transport allows h2c before determining if a request has been sent
1 parent a158d28 commit 3c859a7

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed
 

‎http2/transport.go

+9-2
Original file line numberDiff line numberDiff line change
@@ -864,8 +864,15 @@ func (cc *ClientConn) idleState() clientConnIdleState {
864864
}
865865

866866
func (cc *ClientConn) idleStateLocked() (st clientConnIdleState) {
867-
if cc.singleUse && cc.nextStreamID > 1 {
868-
return
867+
if cc.singleUse {
868+
// h2c requests stream id starts at 3
869+
if cc.t.AllowHTTP && cc.nextStreamID > 3 {
870+
return
871+
}
872+
// else it starts at 1
873+
if !cc.t.AllowHTTP && cc.nextStreamID > 1 {
874+
return
875+
}
869876
}
870877
var maxConcurrentOkay bool
871878
if cc.t.StrictMaxConcurrentStreams {

0 commit comments

Comments
 (0)
Please sign in to comment.