Use TaskCache class from Microsoft.Extensions.TaskCache.Sources instead of Task.FromResult(0) (#99)
This commit is contained in:
parent
7e4c9aaebc
commit
2807e0b436
|
|
@ -5,6 +5,7 @@ using System;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using Microsoft.Extensions.Internal;
|
||||||
|
|
||||||
namespace Microsoft.AspNetCore.Buffering
|
namespace Microsoft.AspNetCore.Buffering
|
||||||
{
|
{
|
||||||
|
|
@ -133,7 +134,7 @@ namespace Microsoft.AspNetCore.Buffering
|
||||||
{
|
{
|
||||||
return FlushAsync(cancellationToken);
|
return FlushAsync(cancellationToken);
|
||||||
}
|
}
|
||||||
return Task.FromResult(0);
|
return TaskCache.CompletedTask;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Write(byte[] buffer, int offset, int count)
|
public override void Write(byte[] buffer, int offset, int count)
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,11 @@
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"Microsoft.AspNetCore.Http.Abstractions": "1.1.0-*"
|
"Microsoft.AspNetCore.Http.Abstractions": "1.1.0-*",
|
||||||
|
"Microsoft.Extensions.TaskCache.Sources": {
|
||||||
|
"version": "1.1.0-*",
|
||||||
|
"type": "build"
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"frameworks": {
|
"frameworks": {
|
||||||
"net451": {},
|
"net451": {},
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,7 @@ using Microsoft.AspNetCore.Hosting;
|
||||||
using Microsoft.AspNetCore.Http;
|
using Microsoft.AspNetCore.Http;
|
||||||
using Microsoft.AspNetCore.Rewrite.Logging;
|
using Microsoft.AspNetCore.Rewrite.Logging;
|
||||||
using Microsoft.Extensions.FileProviders;
|
using Microsoft.Extensions.FileProviders;
|
||||||
|
using Microsoft.Extensions.Internal;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
using Microsoft.Net.Http.Headers;
|
using Microsoft.Net.Http.Headers;
|
||||||
|
|
||||||
|
|
@ -17,8 +18,6 @@ namespace Microsoft.AspNetCore.Rewrite
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class RewriteMiddleware
|
public class RewriteMiddleware
|
||||||
{
|
{
|
||||||
private static readonly Task CompletedTask = Task.FromResult(0);
|
|
||||||
|
|
||||||
private readonly RequestDelegate _next;
|
private readonly RequestDelegate _next;
|
||||||
private readonly RewriteOptions _options;
|
private readonly RewriteOptions _options;
|
||||||
private readonly IFileProvider _fileProvider;
|
private readonly IFileProvider _fileProvider;
|
||||||
|
|
@ -85,7 +84,7 @@ namespace Microsoft.AspNetCore.Rewrite
|
||||||
_logger.RewriteMiddlewareRequestResponseComplete(
|
_logger.RewriteMiddlewareRequestResponseComplete(
|
||||||
context.Response.Headers[HeaderNames.Location],
|
context.Response.Headers[HeaderNames.Location],
|
||||||
context.Response.StatusCode);
|
context.Response.StatusCode);
|
||||||
return CompletedTask;
|
return TaskCache.CompletedTask;
|
||||||
case RuleTermination.StopRules:
|
case RuleTermination.StopRules:
|
||||||
_logger.RewriteMiddlewareRequestStopRules();
|
_logger.RewriteMiddlewareRequestStopRules();
|
||||||
return _next(context);
|
return _next(context);
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,11 @@
|
||||||
"Microsoft.Extensions.Configuration.Abstractions": "1.1.0-*",
|
"Microsoft.Extensions.Configuration.Abstractions": "1.1.0-*",
|
||||||
"Microsoft.Extensions.FileProviders.Abstractions": "1.1.0-*",
|
"Microsoft.Extensions.FileProviders.Abstractions": "1.1.0-*",
|
||||||
"Microsoft.Extensions.Logging.Abstractions": "1.1.0-*",
|
"Microsoft.Extensions.Logging.Abstractions": "1.1.0-*",
|
||||||
"Microsoft.Extensions.Options": "1.1.0-*"
|
"Microsoft.Extensions.Options": "1.1.0-*",
|
||||||
|
"Microsoft.Extensions.TaskCache.Sources": {
|
||||||
|
"version": "1.1.0-*",
|
||||||
|
"type": "build"
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"frameworks": {
|
"frameworks": {
|
||||||
"net451": {
|
"net451": {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue