Skip to content

Add Transport.SetT1 - #4

Closed
pagpeter wants to merge 1 commit into
masterfrom
http2-transport-set-t1
Closed

pagpeter wants to merge 1 commit into
masterfrom
http2-transport-set-t1

Conversation

@pagpeter

Copy link
Copy Markdown
Owner

An http2.Transport built as a struct literal has no t1, so it ignores the HTTP/1 settings it would otherwise read from t1: ResponseHeaderTimeout, DisableKeepAlives and ExpectContinueTimeout. ConfigureTransports is the only way to set t1, and it also registers the HTTP/2 transport on t1's TLSNextProto. Callers that dial their own connections, such as tls-client, do not want that.

SetT1 complements GetT1. It is documented as setup-only: it must be called before the transport is first used, because t1 is read without locking.

tls-client needs it for TransportOptions.ResponseHeaderTimeout (PR to follow). Its if t1 := t2.GetT1(); t1 != nil block in roundtripper.go never runs today for the same reason.

TestTransportResponseHeaderTimeout_* now sets t1 through SetT1 instead of assigning the unexported field, so they test the new API end to end. go test ./... passes.

🤖 Generated with Claude Code

An http2.Transport built as a struct literal has no t1, so it ignores the
HTTP/1 settings it would otherwise read from it, such as
ResponseHeaderTimeout. ConfigureTransports is the only way to set t1, and
it also registers the HTTP/2 transport on t1, which callers that dial
their own connections, like tls-client, do not want.

SetT1 complements GetT1 and lets those callers provide the settings.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant