Use the new HttpContext.Features API.
This commit is contained in:
parent
a60188e10b
commit
916cb32e7e
|
|
@ -38,9 +38,9 @@ namespace Microsoft.AspNet.StaticFiles
|
|||
public Task Invoke(HttpContext context)
|
||||
{
|
||||
// Check if there is a SendFile feature already present
|
||||
if (context.GetFeature<IHttpSendFileFeature>() == null)
|
||||
if (context.Features.Get<IHttpSendFileFeature>() == null)
|
||||
{
|
||||
context.SetFeature<IHttpSendFileFeature>(new SendFileWrapper(context.Response.Body, _logger));
|
||||
context.Features.Set<IHttpSendFileFeature>(new SendFileWrapper(context.Response.Body, _logger));
|
||||
}
|
||||
|
||||
return _next(context);
|
||||
|
|
|
|||
|
|
@ -324,7 +324,7 @@ namespace Microsoft.AspNet.StaticFiles
|
|||
ApplyResponseHeaders(Constants.Status200Ok);
|
||||
|
||||
string physicalPath = _fileInfo.PhysicalPath;
|
||||
var sendFile = _context.GetFeature<IHttpSendFileFeature>();
|
||||
var sendFile = _context.Features.Get<IHttpSendFileFeature>();
|
||||
if (sendFile != null && !string.IsNullOrEmpty(physicalPath))
|
||||
{
|
||||
await sendFile.SendFileAsync(physicalPath, 0, _length, _context.RequestAborted);
|
||||
|
|
@ -371,7 +371,7 @@ namespace Microsoft.AspNet.StaticFiles
|
|||
ApplyResponseHeaders(Constants.Status206PartialContent);
|
||||
|
||||
string physicalPath = _fileInfo.PhysicalPath;
|
||||
var sendFile = _context.GetFeature<IHttpSendFileFeature>();
|
||||
var sendFile = _context.Features.Get<IHttpSendFileFeature>();
|
||||
if (sendFile != null && !string.IsNullOrEmpty(physicalPath))
|
||||
{
|
||||
if (_logger.IsEnabled(LogLevel.Verbose))
|
||||
|
|
|
|||
Loading…
Reference in New Issue