#259 Auto-chunk even for Connection: close responses
This commit is contained in:
Родитель
e1ef220bf1
Коммит
2433448bc7
|
@ -453,14 +453,14 @@ namespace Microsoft.Net.Http.Server
|
|||
_boundaryType = BoundaryType.ContentLength;
|
||||
_expectedBodyLength = 0;
|
||||
}
|
||||
else if (keepConnectionAlive && requestVersion == Constants.V1_1)
|
||||
else if (requestVersion == Constants.V1_1)
|
||||
{
|
||||
_boundaryType = BoundaryType.Chunked;
|
||||
Headers[HttpKnownHeaderNames.TransferEncoding] = Constants.Chunked;
|
||||
}
|
||||
else
|
||||
{
|
||||
// The length cannot be determined, so we must close the connection
|
||||
// v1.0 and the length cannot be determined, so we must close the connection after writing data
|
||||
keepConnectionAlive = false;
|
||||
_boundaryType = BoundaryType.Close;
|
||||
}
|
||||
|
|
|
@ -133,7 +133,8 @@ namespace Microsoft.AspNetCore.Server.WebListener
|
|||
response.EnsureSuccessStatusCode();
|
||||
Assert.True(response.Headers.ConnectionClose.Value);
|
||||
Assert.Equal(new string[] { "close" }, response.Headers.GetValues("Connection"));
|
||||
Assert.False(response.Headers.TransferEncodingChunked.HasValue);
|
||||
Assert.True(response.Headers.TransferEncodingChunked.HasValue);
|
||||
Assert.True(response.Headers.TransferEncodingChunked);
|
||||
IEnumerable<string> values;
|
||||
var result = response.Content.Headers.TryGetValues("Content-Length", out values);
|
||||
Assert.False(result);
|
||||
|
|
Загрузка…
Ссылка в новой задаче