File tree Expand file tree Collapse file tree 1 file changed +33
-0
lines changed Expand file tree Collapse file tree 1 file changed +33
-0
lines changed Original file line number Diff line number Diff line change @@ -6126,6 +6126,39 @@ func TestServerContextsHTTP2(t *testing.T) {
6126
6126
}
6127
6127
}
6128
6128
6129
+ // Issue 35750: check ConnContext not modifying context for other connections
6130
+ func TestConnContextNotModifyingAllContexts (t * testing.T ) {
6131
+ setParallel (t )
6132
+ defer afterTest (t )
6133
+ type connKey struct {}
6134
+ ts := httptest .NewUnstartedServer (HandlerFunc (func (rw ResponseWriter , r * Request ) {
6135
+ rw .Header ().Set ("Connection" , "close" )
6136
+ }))
6137
+ ts .Config .ConnContext = func (ctx context.Context , c net.Conn ) context.Context {
6138
+ if got := ctx .Value (connKey {}); got != nil {
6139
+ t .Errorf ("in ConnContext, unexpected context key = %#v" , got )
6140
+ }
6141
+ return context .WithValue (ctx , connKey {}, "conn" )
6142
+ }
6143
+ ts .Start ()
6144
+ defer ts .Close ()
6145
+
6146
+ var res * Response
6147
+ var err error
6148
+
6149
+ res , err = ts .Client ().Get (ts .URL )
6150
+ if err != nil {
6151
+ t .Fatal (err )
6152
+ }
6153
+ res .Body .Close ()
6154
+
6155
+ res , err = ts .Client ().Get (ts .URL )
6156
+ if err != nil {
6157
+ t .Fatal (err )
6158
+ }
6159
+ res .Body .Close ()
6160
+ }
6161
+
6129
6162
// Issue 30710: ensure that as per the spec, a server responds
6130
6163
// with 501 Not Implemented for unsupported transfer-encodings.
6131
6164
func TestUnsupportedTransferEncodingsReturn501 (t * testing.T ) {
You can’t perform that action at this time.
0 commit comments