@@ -2721,8 +2721,9 @@ func readBodyHandler(t *testing.T, want string) func(w http.ResponseWriter, r *h
2721
2721
}
2722
2722
2723
2723
// TestServerWithCurl currently fails, hence the LenientCipherSuites test. See:
2724
- // https://github.com/tatsuhiro-t/nghttp2/issues/140 &
2725
- // http://sourceforge.net/p/curl/bugs/1472/
2724
+ //
2725
+ // https://github.com/tatsuhiro-t/nghttp2/issues/140 &
2726
+ // http://sourceforge.net/p/curl/bugs/1472/
2726
2727
func TestServerWithCurl (t * testing.T ) { testServerWithCurl (t , false ) }
2727
2728
func TestServerWithCurl_LenientCipherSuites (t * testing.T ) { testServerWithCurl (t , true ) }
2728
2729
@@ -4367,3 +4368,46 @@ func TestNoErrorLoggedOnPostAfterGOAWAY(t *testing.T) {
4367
4368
t .Error ("got protocol error" )
4368
4369
}
4369
4370
}
4371
+
4372
+ func TestProtocolErrorAfterGoAway (t * testing.T ) {
4373
+ st := newServerTester (t , func (w http.ResponseWriter , r * http.Request ) {
4374
+ io .Copy (io .Discard , r .Body )
4375
+ })
4376
+ defer st .Close ()
4377
+
4378
+ st .greet ()
4379
+ content := "some content"
4380
+ st .writeHeaders (HeadersFrameParam {
4381
+ StreamID : 1 ,
4382
+ BlockFragment : st .encodeHeader (
4383
+ ":method" , "POST" ,
4384
+ "content-length" , strconv .Itoa (len (content )),
4385
+ ),
4386
+ EndStream : false ,
4387
+ EndHeaders : true ,
4388
+ })
4389
+ st .writeData (1 , false , []byte (content [:5 ]))
4390
+
4391
+ _ , err := st .readFrame ()
4392
+ if err != nil {
4393
+ st .t .Fatal (err )
4394
+ }
4395
+
4396
+ // Send a GOAWAY with ErrCodeNo, followed by a bogus window update.
4397
+ // The server should close the connection.
4398
+ if err := st .fr .WriteGoAway (1 , ErrCodeNo , nil ); err != nil {
4399
+ t .Fatal (err )
4400
+ }
4401
+ if err := st .fr .WriteWindowUpdate (0 , 1 << 31 - 1 ); err != nil {
4402
+ t .Fatal (err )
4403
+ }
4404
+
4405
+ for {
4406
+ if _ , err := st .readFrame (); err != nil {
4407
+ if err != io .EOF {
4408
+ t .Errorf ("unexpected readFrame error: %v" , err )
4409
+ }
4410
+ break
4411
+ }
4412
+ }
4413
+ }
0 commit comments