Set Content-Length to 0, when returning an empty body
When returning 416 RangeNotSatisfiable in FileResultExecutorBase, set the Content-Length based on the length of the body instead of the length of the original file. Bugfix for : https://github.com/aspnet/AspNetCore/issues/4943
This commit is contained in:
parent
134f28f71d
commit
7af971838e
|
|
@ -322,6 +322,7 @@ namespace Microsoft.AspNetCore.Mvc.Infrastructure
|
|||
// the current length of the selected resource. e.g. */length
|
||||
response.StatusCode = StatusCodes.Status416RangeNotSatisfiable;
|
||||
httpResponseHeaders.ContentRange = new ContentRangeHeaderValue(fileLength);
|
||||
response.ContentLength = 0;
|
||||
|
||||
return (range: null, rangeLength: 0, serveBody: false);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue