@@ -482,16 +482,50 @@ public Task ReadAsHttpResponseMessageAsync_LargeHeaderSize()
482
482
}
483
483
484
484
[ Fact ]
485
- public Task ReadAsHttpRequestMessageAsync_LargeHeaderSize ( )
485
+ public async Task ReadAsHttpRequestMessageAsync_LargeHeaderSize ( )
486
486
{
487
+ string cookieValue = string . Format ( "{0}={1}" , new String ( 'a' , 16 * 1024 ) , new String ( 'b' , 16 * 1024 ) ) ;
487
488
string [ ] request = new [ ] {
488
489
@"GET / HTTP/1.1" ,
489
490
@"Host: msdn.microsoft.com" ,
490
- String . Format ( "Cookie: {0}={1}" , new String ( 'a' , 16 * 1024 ) , new String ( 'b' , 16 * 1024 ) )
491
+ string . Format ( "Cookie: {0}" , cookieValue ) ,
492
+ } ;
493
+
494
+ HttpContent content = CreateContent ( true , request , "sample body" ) ;
495
+ var httpRequestMessage = await content . ReadAsHttpRequestMessageAsync ( Uri . UriSchemeHttp , 64 * 1024 , 64 * 1024 ) ;
496
+
497
+ Assert . Equal ( HttpMethod . Get , httpRequestMessage . Method ) ;
498
+ Assert . Equal ( "/" , httpRequestMessage . RequestUri . PathAndQuery ) ;
499
+ Assert . Equal ( "msdn.microsoft.com" , httpRequestMessage . Headers . Host ) ;
500
+ IEnumerable < string > actualCookieValue ;
501
+ Assert . True ( httpRequestMessage . Headers . TryGetValues ( "Cookie" , out actualCookieValue ) ) ;
502
+ Assert . Equal ( cookieValue , Assert . Single ( actualCookieValue ) ) ;
503
+ }
504
+
505
+ [ Fact ]
506
+ public async Task ReadAsHttpRequestMessageAsync_LargeHttpRequestLine ( )
507
+ {
508
+ string requestPath = string . Format ( "/myurl?{0}={1}" , new string ( 'a' , 4 * 1024 ) , new string ( 'b' , 4 * 1024 ) ) ;
509
+ string cookieValue = string . Format ( "{0}={1}" , new String ( 'a' , 4 * 1024 ) , new String ( 'b' , 4 * 1024 ) ) ;
510
+ string [ ] request = new [ ]
511
+ {
512
+ string . Format ( "GET {0} HTTP/1.1" , requestPath ) ,
513
+ @"Host: msdn.microsoft.com" ,
514
+ string . Format ( "Cookie: {0}" , cookieValue ) ,
491
515
} ;
492
516
493
517
HttpContent content = CreateContent ( true , request , "sample body" ) ;
494
- return content . ReadAsHttpRequestMessageAsync ( Uri . UriSchemeHttp , 64 * 1024 , 64 * 1024 ) ;
518
+ var httpRequestMessage = await content . ReadAsHttpRequestMessageAsync (
519
+ Uri . UriSchemeHttp ,
520
+ bufferSize : 64 * 1024 ,
521
+ maxHeaderSize : 64 * 1024 ) ;
522
+
523
+ Assert . Equal ( HttpMethod . Get , httpRequestMessage . Method ) ;
524
+ Assert . Equal ( requestPath , httpRequestMessage . RequestUri . PathAndQuery ) ;
525
+ Assert . Equal ( "msdn.microsoft.com" , httpRequestMessage . Headers . Host ) ;
526
+ IEnumerable < string > actualCookieValue ;
527
+ Assert . True ( httpRequestMessage . Headers . TryGetValues ( "Cookie" , out actualCookieValue ) ) ;
528
+ Assert . Equal ( cookieValue , Assert . Single ( actualCookieValue ) ) ;
495
529
}
496
530
497
531
[ Theory ]
0 commit comments