File tree Expand file tree Collapse file tree 1 file changed +5
-4
lines changed
src/Servers/Kestrel/test/InMemory.FunctionalTests Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -141,8 +141,10 @@ public Task BadRequestIfHostHeaderDoesNotMatchRequestTarget(string requestTarget
141141 CoreStrings . FormatBadRequest_InvalidHostHeader_Detail ( host . Trim ( ) ) ) ;
142142 }
143143
144- [ Fact ]
145- public async Task CanOptOutOfBadRequestIfHostHeaderDoesNotMatchRequestTarget ( )
144+ [ Theory ]
145+ [ InlineData ( "Host: www.foo.comConnection: keep-alive" ) ] // Corrupted - missing line-break
146+ [ InlineData ( "Host: www.notfoo.com" ) ] // Syntactically correct but not matching
147+ public async Task CanOptOutOfBadRequestIfHostHeaderDoesNotMatchRequestTarget ( string hostHeader )
146148 {
147149 var receivedHost = StringValues . Empty ;
148150 await using var server = new TestServer ( context =>
@@ -158,8 +160,7 @@ public async Task CanOptOutOfBadRequestIfHostHeaderDoesNotMatchRequestTarget()
158160 } ) ;
159161 using var client = server . CreateConnection ( ) ;
160162
161- // Note the missing line-reak between the Host and Connection headers
162- await client . SendAll ( $ "GET http://www.foo.com/api/data HTTP/1.1\r \n Host: www.foo.comConnection: keep-alive\r \n \r \n ") ;
163+ await client . SendAll ( $ "GET http://www.foo.com/api/data HTTP/1.1\r \n { hostHeader } \r \n \r \n ") ;
163164
164165 await client . Receive ( "HTTP/1.1 200 OK" ) ;
165166
You can’t perform that action at this time.
0 commit comments