Add request parsing regression tests.

This commit is contained in:
Cesar Blum Silveira 2017-09-13 14:49:45 -07:00 committed by GitHub
parent 1e465e9643
commit da7bc24eec
2 changed files with 18 additions and 0 deletions

View File

@ -169,6 +169,22 @@ namespace Microsoft.AspNetCore.Server.Kestrel.FunctionalTests
Assert.Equal(LogLevel.Information, maxLogLevel);
}
[Fact]
public async Task TestRequestSplitting()
{
using (var server = new TestServer(context => Task.CompletedTask, new TestServiceContext { Log = Mock.Of<IKestrelTrace>() }))
{
using (var client = server.CreateConnection())
{
await client.SendAll(
"GET /\x0D\0x0ALocation:http://www.contoso.com/ HTTP/1.1",
"Host:\r\n\r\n");
await client.ReceiveStartsWith("HTTP/1.1 400");
}
}
}
private async Task TestBadRequest(string request, string expectedResponseStatusCode, string expectedExceptionMessage, string expectedAllowHeader = null)
{
BadHttpRequestException loggedException = null;

View File

@ -219,6 +219,7 @@ namespace Microsoft.AspNetCore.Testing
"}",
"get@",
"post=",
"[0x00]"
}.Concat(MethodWithNullCharData);
}
}
@ -435,6 +436,7 @@ namespace Microsoft.AspNetCore.Testing
{ "OPTIONS *", "" },
{ "GET /pub/WWW/", "" },
{ "GET /pub/WWW/", " " },
{ "GET /pub/WWW/", "." },
{ "GET /pub/WWW/", "www.example.org" },
{ "GET http://localhost/", "localhost" },
{ "GET http://localhost:80/", "localhost:80" },