Incorporate name changes from HttpAbstractions
This commit is contained in:
parent
89b958b8e6
commit
bc31b50b45
|
|
@ -51,15 +51,15 @@ namespace Microsoft.AspNet.StaticFiles
|
||||||
public Task Invoke(HttpContext context)
|
public Task Invoke(HttpContext context)
|
||||||
{
|
{
|
||||||
// Check if there is a SendFile feature already present
|
// Check if there is a SendFile feature already present
|
||||||
if (context.GetFeature<IHttpSendFile>() == null)
|
if (context.GetFeature<IHttpSendFileFeature>() == null)
|
||||||
{
|
{
|
||||||
context.SetFeature<IHttpSendFile>(new SendFileWrapper(context.Response.Body));
|
context.SetFeature<IHttpSendFileFeature>(new SendFileWrapper(context.Response.Body));
|
||||||
}
|
}
|
||||||
|
|
||||||
return _next(context);
|
return _next(context);
|
||||||
}
|
}
|
||||||
|
|
||||||
private class SendFileWrapper : IHttpSendFile
|
private class SendFileWrapper : IHttpSendFileFeature
|
||||||
{
|
{
|
||||||
private readonly Stream _output;
|
private readonly Stream _output;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -39,7 +39,7 @@ namespace Microsoft.AspNet.StaticFiles
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException("response");
|
throw new ArgumentNullException("response");
|
||||||
}
|
}
|
||||||
return response.HttpContext.GetFeature<IHttpSendFile>() != null;
|
return response.HttpContext.GetFeature<IHttpSendFileFeature>() != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
@ -72,7 +72,7 @@ namespace Microsoft.AspNet.StaticFiles
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException("response");
|
throw new ArgumentNullException("response");
|
||||||
}
|
}
|
||||||
IHttpSendFile sendFile = response.HttpContext.GetFeature<IHttpSendFile>();
|
var sendFile = response.HttpContext.GetFeature<IHttpSendFileFeature>();
|
||||||
if (sendFile == null)
|
if (sendFile == null)
|
||||||
{
|
{
|
||||||
throw new NotSupportedException(Resources.Exception_SendFileNotSupported);
|
throw new NotSupportedException(Resources.Exception_SendFileNotSupported);
|
||||||
|
|
|
||||||
|
|
@ -331,7 +331,7 @@ namespace Microsoft.AspNet.StaticFiles
|
||||||
ApplyResponseHeaders(Constants.Status200Ok);
|
ApplyResponseHeaders(Constants.Status200Ok);
|
||||||
|
|
||||||
string physicalPath = _fileInfo.PhysicalPath;
|
string physicalPath = _fileInfo.PhysicalPath;
|
||||||
IHttpSendFile sendFile = _context.GetFeature<IHttpSendFile>();
|
var sendFile = _context.GetFeature<IHttpSendFileFeature>();
|
||||||
if (sendFile != null && !string.IsNullOrEmpty(physicalPath))
|
if (sendFile != null && !string.IsNullOrEmpty(physicalPath))
|
||||||
{
|
{
|
||||||
await sendFile.SendFileAsync(physicalPath, 0, _length, _request.CallCanceled);
|
await sendFile.SendFileAsync(physicalPath, 0, _length, _request.CallCanceled);
|
||||||
|
|
@ -377,7 +377,7 @@ namespace Microsoft.AspNet.StaticFiles
|
||||||
ApplyResponseHeaders(Constants.Status206PartialContent);
|
ApplyResponseHeaders(Constants.Status206PartialContent);
|
||||||
|
|
||||||
string physicalPath = _fileInfo.PhysicalPath;
|
string physicalPath = _fileInfo.PhysicalPath;
|
||||||
IHttpSendFile sendFile = _context.GetFeature<IHttpSendFile>();
|
var sendFile = _context.GetFeature<IHttpSendFileFeature>();
|
||||||
if (sendFile != null && !string.IsNullOrEmpty(physicalPath))
|
if (sendFile != null && !string.IsNullOrEmpty(physicalPath))
|
||||||
{
|
{
|
||||||
await sendFile.SendFileAsync(physicalPath, start, length, _request.CallCanceled);
|
await sendFile.SendFileAsync(physicalPath, start, length, _request.CallCanceled);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue