File tree Expand file tree Collapse file tree 1 file changed +33
-0
lines changed
src/Servers/Kestrel/test/InMemory.FunctionalTests Expand file tree Collapse file tree 1 file changed +33
-0
lines changed Original file line number Diff line number Diff line change @@ -343,5 +343,38 @@ await connection.Receive("HTTP/1.1 101 Switching Protocols",
343
343
await appCompletedTcs . Task . DefaultTimeout ( ) ;
344
344
}
345
345
}
346
+
347
+ [ Fact ]
348
+ public async Task DoesNotCloseConnectionWithout101Response ( )
349
+ {
350
+ var requestCount = 0 ;
351
+
352
+ await using ( var server = new TestServer ( async context =>
353
+ {
354
+ if ( requestCount ++ > 0 )
355
+ {
356
+ await context . Features . Get < IHttpUpgradeFeature > ( ) . UpgradeAsync ( ) ;
357
+ }
358
+ } , new TestServiceContext ( LoggerFactory ) ) )
359
+ {
360
+ using ( var connection = server . CreateConnection ( ) )
361
+ {
362
+ await connection . SendEmptyGetWithUpgrade ( ) ;
363
+ await connection . Receive (
364
+ "HTTP/1.1 200 OK" ,
365
+ $ "Date: { server . Context . DateHeaderValue } ",
366
+ "Content-Length: 0" ,
367
+ "" ,
368
+ "" ) ;
369
+
370
+ await connection . SendEmptyGetWithUpgrade ( ) ;
371
+ await connection . Receive ( "HTTP/1.1 101 Switching Protocols" ,
372
+ "Connection: Upgrade" ,
373
+ $ "Date: { server . Context . DateHeaderValue } ",
374
+ "" ,
375
+ "" ) ;
376
+ }
377
+ }
378
+ }
346
379
}
347
380
}
You can’t perform that action at this time.
0 commit comments