Skip to content
This repository was archived by the owner on Nov 22, 2018. It is now read-only.

Commit 80eb5ab

Browse files
committed
Use updated request cancellation API.
1 parent 93e27e2 commit 80eb5ab

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/Microsoft.AspNet.StaticFiles/StaticFileContext.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -319,14 +319,14 @@ public async Task SendAsync()
319319
var sendFile = _context.GetFeature<IHttpSendFileFeature>();
320320
if (sendFile != null && !string.IsNullOrEmpty(physicalPath))
321321
{
322-
await sendFile.SendFileAsync(physicalPath, 0, _length, _request.CallCanceled);
322+
await sendFile.SendFileAsync(physicalPath, 0, _length, _context.OnRequestAborted);
323323
return;
324324
}
325325

326326
Stream readStream = _fileInfo.CreateReadStream();
327327
try
328328
{
329-
await StreamCopyOperation.CopyToAsync(readStream, _response.Body, _length, _request.CallCanceled);
329+
await StreamCopyOperation.CopyToAsync(readStream, _response.Body, _length, _context.OnRequestAborted);
330330
}
331331
finally
332332
{
@@ -365,15 +365,15 @@ internal async Task SendRangeAsync()
365365
var sendFile = _context.GetFeature<IHttpSendFileFeature>();
366366
if (sendFile != null && !string.IsNullOrEmpty(physicalPath))
367367
{
368-
await sendFile.SendFileAsync(physicalPath, start, length, _request.CallCanceled);
368+
await sendFile.SendFileAsync(physicalPath, start, length, _context.OnRequestAborted);
369369
return;
370370
}
371371

372372
Stream readStream = _fileInfo.CreateReadStream();
373373
try
374374
{
375375
readStream.Seek(start, SeekOrigin.Begin); // TODO: What if !CanSeek?
376-
await StreamCopyOperation.CopyToAsync(readStream, _response.Body, length, _request.CallCanceled);
376+
await StreamCopyOperation.CopyToAsync(readStream, _response.Body, length, _context.OnRequestAborted);
377377
}
378378
finally
379379
{

0 commit comments

Comments
 (0)