@@ -482,16 +482,50 @@ public Task ReadAsHttpResponseMessageAsync_LargeHeaderSize()
482482 }
483483
484484 [ Fact ]
485- public Task ReadAsHttpRequestMessageAsync_LargeHeaderSize ( )
485+ public async Task ReadAsHttpRequestMessageAsync_LargeHeaderSize ( )
486486 {
487+ string cookieValue = string . Format ( "{0}={1}" , new String ( 'a' , 16 * 1024 ) , new String ( 'b' , 16 * 1024 ) ) ;
487488 string [ ] request = new [ ] {
488489 @"GET / HTTP/1.1" ,
489490 @"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 ) ,
491515 } ;
492516
493517 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 ) ) ;
495529 }
496530
497531 [ Theory ]
0 commit comments