11
11
using Microsoft . AspNetCore . Http ;
12
12
using Microsoft . AspNetCore . Http . Features ;
13
13
using Microsoft . AspNetCore . Http2Cat ;
14
+ using Microsoft . AspNetCore . Server ;
14
15
using Microsoft . AspNetCore . Server . Kestrel . Core . Internal . Http2 ;
15
16
using Microsoft . AspNetCore . Testing ;
16
17
using Microsoft . Extensions . Hosting ;
@@ -48,7 +49,7 @@ public async Task EmptyResponse_200()
48
49
49
50
await h2Connection . ReceiveHeadersAsync ( 1 , decodedHeaders =>
50
51
{
51
- Assert . Equal ( "200" , decodedHeaders [ HeaderNames . Status ] ) ;
52
+ Assert . Equal ( "200" , decodedHeaders [ PseudoHeaderNames . Status ] ) ;
52
53
} ) ;
53
54
54
55
var dataFrame = await h2Connection . ReceiveFrameAsync ( ) ;
@@ -79,17 +80,17 @@ public async Task RequestWithoutData_LengthRequired_Rejected(string method)
79
80
80
81
var headers = new [ ]
81
82
{
82
- new KeyValuePair < string , string > ( HeaderNames . Method , method ) ,
83
- new KeyValuePair < string , string > ( HeaderNames . Path , "/" ) ,
84
- new KeyValuePair < string , string > ( HeaderNames . Scheme , "https" ) ,
85
- new KeyValuePair < string , string > ( HeaderNames . Authority , "localhost:80" ) ,
83
+ new KeyValuePair < string , string > ( PseudoHeaderNames . Method , method ) ,
84
+ new KeyValuePair < string , string > ( PseudoHeaderNames . Path , "/" ) ,
85
+ new KeyValuePair < string , string > ( PseudoHeaderNames . Scheme , "https" ) ,
86
+ new KeyValuePair < string , string > ( PseudoHeaderNames . Authority , "localhost:80" ) ,
86
87
} ;
87
88
88
89
await h2Connection . StartStreamAsync ( 1 , headers , endStream : true ) ;
89
90
90
91
await h2Connection . ReceiveHeadersAsync ( 1 , decodedHeaders =>
91
92
{
92
- Assert . Equal ( "411" , decodedHeaders [ HeaderNames . Status ] ) ;
93
+ Assert . Equal ( "411" , decodedHeaders [ PseudoHeaderNames . Status ] ) ;
93
94
} ) ;
94
95
95
96
var dataFrame = await h2Connection . ReceiveFrameAsync ( ) ;
@@ -129,17 +130,17 @@ public async Task RequestWithoutData_Success(string method)
129
130
130
131
var headers = new [ ]
131
132
{
132
- new KeyValuePair < string , string > ( HeaderNames . Method , method ) ,
133
- new KeyValuePair < string , string > ( HeaderNames . Path , "/" ) ,
134
- new KeyValuePair < string , string > ( HeaderNames . Scheme , "https" ) ,
135
- new KeyValuePair < string , string > ( HeaderNames . Authority , "localhost:80" ) ,
133
+ new KeyValuePair < string , string > ( PseudoHeaderNames . Method , method ) ,
134
+ new KeyValuePair < string , string > ( PseudoHeaderNames . Path , "/" ) ,
135
+ new KeyValuePair < string , string > ( PseudoHeaderNames . Scheme , "https" ) ,
136
+ new KeyValuePair < string , string > ( PseudoHeaderNames . Authority , "localhost:80" ) ,
136
137
} ;
137
138
138
139
await h2Connection . StartStreamAsync ( 1 , headers , endStream : true ) ;
139
140
140
141
await h2Connection . ReceiveHeadersAsync ( 1 , decodedHeaders =>
141
142
{
142
- Assert . Equal ( "200" , decodedHeaders [ HeaderNames . Status ] ) ;
143
+ Assert . Equal ( "200" , decodedHeaders [ PseudoHeaderNames . Status ] ) ;
143
144
} ) ;
144
145
145
146
var dataFrame = await h2Connection . ReceiveFrameAsync ( ) ;
@@ -179,10 +180,10 @@ public async Task RequestWithDataAndContentLength_Success(string method)
179
180
180
181
var headers = new [ ]
181
182
{
182
- new KeyValuePair < string , string > ( HeaderNames . Method , method ) ,
183
- new KeyValuePair < string , string > ( HeaderNames . Path , "/" ) ,
184
- new KeyValuePair < string , string > ( HeaderNames . Scheme , "https" ) ,
185
- new KeyValuePair < string , string > ( HeaderNames . Authority , "localhost:80" ) ,
183
+ new KeyValuePair < string , string > ( PseudoHeaderNames . Method , method ) ,
184
+ new KeyValuePair < string , string > ( PseudoHeaderNames . Path , "/" ) ,
185
+ new KeyValuePair < string , string > ( PseudoHeaderNames . Scheme , "https" ) ,
186
+ new KeyValuePair < string , string > ( PseudoHeaderNames . Authority , "localhost:80" ) ,
186
187
new KeyValuePair < string , string > ( HeaderNames . ContentLength , "11" ) ,
187
188
} ;
188
189
@@ -199,7 +200,7 @@ public async Task RequestWithDataAndContentLength_Success(string method)
199
200
200
201
await h2Connection . ReceiveHeadersAsync ( 1 , decodedHeaders =>
201
202
{
202
- Assert . Equal ( "200" , decodedHeaders [ HeaderNames . Status ] ) ;
203
+ Assert . Equal ( "200" , decodedHeaders [ PseudoHeaderNames . Status ] ) ;
203
204
} ) ;
204
205
205
206
var dataFrame = await h2Connection . ReceiveFrameAsync ( ) ;
@@ -244,10 +245,10 @@ public async Task RequestWithDataAndNoContentLength_Success(string method)
244
245
245
246
var headers = new [ ]
246
247
{
247
- new KeyValuePair < string , string > ( HeaderNames . Method , method ) ,
248
- new KeyValuePair < string , string > ( HeaderNames . Path , "/" ) ,
249
- new KeyValuePair < string , string > ( HeaderNames . Scheme , "https" ) ,
250
- new KeyValuePair < string , string > ( HeaderNames . Authority , "localhost:80" ) ,
248
+ new KeyValuePair < string , string > ( PseudoHeaderNames . Method , method ) ,
249
+ new KeyValuePair < string , string > ( PseudoHeaderNames . Path , "/" ) ,
250
+ new KeyValuePair < string , string > ( PseudoHeaderNames . Scheme , "https" ) ,
251
+ new KeyValuePair < string , string > ( PseudoHeaderNames . Authority , "localhost:80" ) ,
251
252
} ;
252
253
253
254
await h2Connection . StartStreamAsync ( 1 , headers , endStream : false ) ;
@@ -263,7 +264,7 @@ public async Task RequestWithDataAndNoContentLength_Success(string method)
263
264
264
265
await h2Connection . ReceiveHeadersAsync ( 1 , decodedHeaders =>
265
266
{
266
- Assert . Equal ( "200" , decodedHeaders [ HeaderNames . Status ] ) ;
267
+ Assert . Equal ( "200" , decodedHeaders [ PseudoHeaderNames . Status ] ) ;
267
268
} ) ;
268
269
269
270
var dataFrame = await h2Connection . ReceiveFrameAsync ( ) ;
@@ -298,7 +299,7 @@ public async Task ResponseWithData_Success()
298
299
299
300
await h2Connection . ReceiveHeadersAsync ( 1 , decodedHeaders =>
300
301
{
301
- Assert . Equal ( "200" , decodedHeaders [ HeaderNames . Status ] ) ;
302
+ Assert . Equal ( "200" , decodedHeaders [ PseudoHeaderNames . Status ] ) ;
302
303
} ) ;
303
304
304
305
var dataFrame = await h2Connection . ReceiveFrameAsync ( ) ;
@@ -336,7 +337,7 @@ await h2Connection.ReceiveHeadersAsync(1, endStream: true, decodedHeaders =>
336
337
{
337
338
// HTTP/2 filters out the connection header
338
339
Assert . False ( decodedHeaders . ContainsKey ( HeaderNames . Connection ) ) ;
339
- Assert . Equal ( "200" , decodedHeaders [ HeaderNames . Status ] ) ;
340
+ Assert . Equal ( "200" , decodedHeaders [ PseudoHeaderNames . Status ] ) ;
340
341
} ) ;
341
342
342
343
// Send and receive a second request to ensure there is no GoAway frame on the wire yet.
@@ -347,7 +348,7 @@ await h2Connection.ReceiveHeadersAsync(3, endStream: true, decodedHeaders =>
347
348
{
348
349
// HTTP/2 filters out the connection header
349
350
Assert . False ( decodedHeaders . ContainsKey ( HeaderNames . Connection ) ) ;
350
- Assert . Equal ( "200" , decodedHeaders [ HeaderNames . Status ] ) ;
351
+ Assert . Equal ( "200" , decodedHeaders [ PseudoHeaderNames . Status ] ) ;
351
352
} ) ;
352
353
353
354
await h2Connection . StopConnectionAsync ( expectedLastStreamId : 1 , ignoreNonGoAwayFrames : false ) ;
@@ -383,7 +384,7 @@ await h2Connection.ReceiveHeadersAsync(1, decodedHeaders =>
383
384
{
384
385
// HTTP/2 filters out the connection header
385
386
Assert . False ( decodedHeaders . ContainsKey ( HeaderNames . Connection ) ) ;
386
- Assert . Equal ( "200" , decodedHeaders [ HeaderNames . Status ] ) ;
387
+ Assert . Equal ( "200" , decodedHeaders [ PseudoHeaderNames . Status ] ) ;
387
388
} ) ;
388
389
389
390
var dataFrame = await h2Connection . ReceiveFrameAsync ( ) ;
@@ -422,7 +423,7 @@ await h2Connection.ReceiveHeadersAsync(1, decodedHeaders =>
422
423
{
423
424
// HTTP/2 filters out the connection header
424
425
Assert . False ( decodedHeaders . ContainsKey ( HeaderNames . Connection ) ) ;
425
- Assert . Equal ( "200" , decodedHeaders [ HeaderNames . Status ] ) ;
426
+ Assert . Equal ( "200" , decodedHeaders [ PseudoHeaderNames . Status ] ) ;
426
427
} ) ;
427
428
428
429
var dataFrame = await h2Connection . ReceiveFrameAsync ( ) ;
@@ -462,7 +463,7 @@ await h2Connection.ReceiveHeadersAsync(streamId, decodedHeaders =>
462
463
{
463
464
// HTTP/2 filters out the connection header
464
465
Assert . False ( decodedHeaders . ContainsKey ( HeaderNames . Connection ) ) ;
465
- Assert . Equal ( "200" , decodedHeaders [ HeaderNames . Status ] ) ;
466
+ Assert . Equal ( "200" , decodedHeaders [ PseudoHeaderNames . Status ] ) ;
466
467
} ) ;
467
468
468
469
var dataFrame = await h2Connection . ReceiveFrameAsync ( ) ;
@@ -479,7 +480,7 @@ await h2Connection.ReceiveHeadersAsync(streamId, decodedHeaders =>
479
480
{
480
481
// HTTP/2 filters out the connection header
481
482
Assert . False ( decodedHeaders . ContainsKey ( HeaderNames . Connection ) ) ;
482
- Assert . Equal ( "200" , decodedHeaders [ HeaderNames . Status ] ) ;
483
+ Assert . Equal ( "200" , decodedHeaders [ PseudoHeaderNames . Status ] ) ;
483
484
} ) ;
484
485
485
486
dataFrame = await h2Connection . ReceiveFrameAsync ( ) ;
@@ -498,7 +499,7 @@ await h2Connection.ReceiveHeadersAsync(streamId, decodedHeaders =>
498
499
{
499
500
// HTTP/2 filters out the connection header
500
501
Assert . False ( decodedHeaders . ContainsKey ( HeaderNames . Connection ) ) ;
501
- Assert . Equal ( "200" , decodedHeaders [ HeaderNames . Status ] ) ;
502
+ Assert . Equal ( "200" , decodedHeaders [ PseudoHeaderNames . Status ] ) ;
502
503
} ) ;
503
504
504
505
dataFrame = await h2Connection . ReceiveFrameAsync ( ) ;
@@ -529,7 +530,7 @@ public async Task AppException_BeforeResponseHeaders_500()
529
530
530
531
await h2Connection . ReceiveHeadersAsync ( 1 , decodedHeaders =>
531
532
{
532
- Assert . Equal ( "500" , decodedHeaders [ HeaderNames . Status ] ) ;
533
+ Assert . Equal ( "500" , decodedHeaders [ PseudoHeaderNames . Status ] ) ;
533
534
} ) ;
534
535
535
536
var dataFrame = await h2Connection . ReceiveFrameAsync ( ) ;
@@ -562,7 +563,7 @@ public async Task AppException_AfterHeaders_PriorOSVersions_ResetCancel()
562
563
563
564
await h2Connection . ReceiveHeadersAsync ( 1 , decodedHeaders =>
564
565
{
565
- Assert . Equal ( "200" , decodedHeaders [ HeaderNames . Status ] ) ;
566
+ Assert . Equal ( "200" , decodedHeaders [ PseudoHeaderNames . Status ] ) ;
566
567
} ) ;
567
568
568
569
var resetFrame = await h2Connection . ReceiveFrameAsync ( ) ;
@@ -594,7 +595,7 @@ public async Task AppException_AfterHeaders_ResetInternalError()
594
595
595
596
await h2Connection . ReceiveHeadersAsync ( 1 , decodedHeaders =>
596
597
{
597
- Assert . Equal ( "200" , decodedHeaders [ HeaderNames . Status ] ) ;
598
+ Assert . Equal ( "200" , decodedHeaders [ PseudoHeaderNames . Status ] ) ;
598
599
} ) ;
599
600
600
601
var frame = await h2Connection . ReceiveFrameAsync ( ) ;
@@ -723,7 +724,7 @@ public async Task Reset_AfterResponseHeaders_Resets()
723
724
724
725
await h2Connection . ReceiveHeadersAsync ( 1 , decodedHeaders =>
725
726
{
726
- Assert . Equal ( "200" , decodedHeaders [ HeaderNames . Status ] ) ;
727
+ Assert . Equal ( "200" , decodedHeaders [ PseudoHeaderNames . Status ] ) ;
727
728
} ) ;
728
729
729
730
var resetFrame = await h2Connection . ReceiveFrameAsync ( ) ;
@@ -770,7 +771,7 @@ public async Task Reset_DurringResponseBody_Resets()
770
771
771
772
await h2Connection . ReceiveHeadersAsync ( 1 , decodedHeaders =>
772
773
{
773
- Assert . Equal ( "200" , decodedHeaders [ HeaderNames . Status ] ) ;
774
+ Assert . Equal ( "200" , decodedHeaders [ PseudoHeaderNames . Status ] ) ;
774
775
} ) ;
775
776
776
777
var dataFrame = await h2Connection . ReceiveFrameAsync ( ) ;
@@ -822,7 +823,7 @@ public async Task Reset_AfterCompleteAsync_NoReset()
822
823
823
824
await h2Connection . ReceiveHeadersAsync ( 1 , decodedHeaders =>
824
825
{
825
- Assert . Equal ( "200" , decodedHeaders [ HeaderNames . Status ] ) ;
826
+ Assert . Equal ( "200" , decodedHeaders [ PseudoHeaderNames . Status ] ) ;
826
827
} ) ;
827
828
828
829
var dataFrame = await h2Connection . ReceiveFrameAsync ( ) ;
@@ -975,7 +976,7 @@ public async Task Reset_CompleteAsyncDurringRequestBody_Resets()
975
976
976
977
await h2Connection . ReceiveHeadersAsync ( 1 , decodedHeaders =>
977
978
{
978
- Assert . Equal ( "200" , decodedHeaders [ HeaderNames . Status ] ) ;
979
+ Assert . Equal ( "200" , decodedHeaders [ PseudoHeaderNames . Status ] ) ;
979
980
} ) ;
980
981
981
982
var dataFrame = await h2Connection . ReceiveFrameAsync ( ) ;
0 commit comments