PR feedback
This commit is contained in:
parent
1e59352466
commit
e9ef38cf3a
|
|
@ -451,7 +451,7 @@ namespace Microsoft.Net.Http.Server
|
|||
_boundaryType = BoundaryType.ContentLength;
|
||||
// ComputeLeftToWrite checks for HEAD requests when setting _leftToWrite
|
||||
_expectedBodyLength = responseContentLength.Value;
|
||||
if (responseContentLength.Value == writeCount && !isHeadRequest)
|
||||
if (_expectedBodyLength == writeCount && !isHeadRequest)
|
||||
{
|
||||
// A single write with the whole content-length. Http.Sys will set the content-length for us in this scenario.
|
||||
// If we don't remove it then range requests served from cache will have two.
|
||||
|
|
|
|||
|
|
@ -291,6 +291,8 @@ namespace Microsoft.Net.Http.Server
|
|||
context.Response.ContentLength = 10;
|
||||
context.Response.CacheTtl = TimeSpan.FromSeconds(10);
|
||||
context.Response.Body.Write(new byte[10], 0, 10);
|
||||
// Http.Sys will add this for us
|
||||
Assert.Null(context.Response.ContentLength);
|
||||
context.Dispose();
|
||||
|
||||
var response = await responseTask;
|
||||
|
|
@ -320,6 +322,8 @@ namespace Microsoft.Net.Http.Server
|
|||
context.Response.ContentLength = 10;
|
||||
context.Response.CacheTtl = TimeSpan.FromSeconds(10);
|
||||
await context.Response.Body.WriteAsync(new byte[10], 0, 10);
|
||||
// Http.Sys will add this for us
|
||||
Assert.Null(context.Response.ContentLength);
|
||||
context.Dispose();
|
||||
|
||||
var response = await responseTask;
|
||||
|
|
@ -416,6 +420,8 @@ namespace Microsoft.Net.Http.Server
|
|||
context.Response.ContentLength = 10;
|
||||
context.Response.CacheTtl = TimeSpan.FromSeconds(10);
|
||||
context.Response.Body.Write(new byte[10], 0, 10);
|
||||
// Http.Sys will add this for us
|
||||
Assert.Null(context.Response.ContentLength);
|
||||
context.Dispose();
|
||||
|
||||
var response = await responseTask;
|
||||
|
|
@ -478,6 +484,8 @@ namespace Microsoft.Net.Http.Server
|
|||
context.Response.ContentLength =_fileLength;
|
||||
context.Response.CacheTtl = TimeSpan.FromSeconds(10);
|
||||
await context.Response.SendFileAsync(_absoluteFilePath, 0, null, CancellationToken.None);
|
||||
// Http.Sys will add this for us
|
||||
Assert.Null(context.Response.ContentLength);
|
||||
context.Dispose();
|
||||
|
||||
var response = await responseTask;
|
||||
|
|
|
|||
Loading…
Reference in New Issue