diff --git a/src/Microsoft.AspNet.Server.Kestrel/Http/Frame.cs b/src/Microsoft.AspNet.Server.Kestrel/Http/Frame.cs
index 7f51d8e7d4..36f1d92319 100644
--- a/src/Microsoft.AspNet.Server.Kestrel/Http/Frame.cs
+++ b/src/Microsoft.AspNet.Server.Kestrel/Http/Frame.cs
@@ -206,9 +206,10 @@ namespace Microsoft.AspNet.Server.Kestrel.Http
ResponseBody = new FrameResponseStream(this);
DuplexStream = new FrameDuplexStream(RequestBody, ResponseBody);
+ var httpContext = HttpContextFactory.Create(this);
try
{
- await Application.Invoke(this).ConfigureAwait(false);
+ await Application.Invoke(httpContext).ConfigureAwait(false);
}
catch (Exception ex)
{
@@ -227,6 +228,8 @@ namespace Microsoft.AspNet.Server.Kestrel.Http
await FireOnCompleted();
+ HttpContextFactory.Dispose(httpContext);
+
await ProduceEnd();
while (await RequestBody.ReadAsync(_nullBuffer, 0, _nullBuffer.Length) != 0)
diff --git a/src/Microsoft.AspNet.Server.Kestrel/Http/Listener.cs b/src/Microsoft.AspNet.Server.Kestrel/Http/Listener.cs
index 8cfba60cd0..a7b72acc01 100644
--- a/src/Microsoft.AspNet.Server.Kestrel/Http/Listener.cs
+++ b/src/Microsoft.AspNet.Server.Kestrel/Http/Listener.cs
@@ -3,6 +3,7 @@
using System;
using System.Threading.Tasks;
+using Microsoft.AspNet.Http;
using Microsoft.AspNet.Server.Kestrel.Networking;
using Microsoft.Extensions.Logging;
@@ -23,7 +24,7 @@ namespace Microsoft.AspNet.Server.Kestrel.Http
public Task StartAsync(
ServerAddress address,
KestrelThread thread,
- Func application)
+ RequestDelegate application)
{
ServerAddress = address;
Thread = thread;
diff --git a/src/Microsoft.AspNet.Server.Kestrel/Http/ListenerContext.cs b/src/Microsoft.AspNet.Server.Kestrel/Http/ListenerContext.cs
index 79a096d4d4..5817200410 100644
--- a/src/Microsoft.AspNet.Server.Kestrel/Http/ListenerContext.cs
+++ b/src/Microsoft.AspNet.Server.Kestrel/Http/ListenerContext.cs
@@ -1,8 +1,7 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
-using System;
-using System.Threading.Tasks;
+using Microsoft.AspNet.Http;
using Microsoft.AspNet.Server.Kestrel.Infrastructure;
namespace Microsoft.AspNet.Server.Kestrel.Http
@@ -34,7 +33,7 @@ namespace Microsoft.AspNet.Server.Kestrel.Http
public KestrelThread Thread { get; set; }
- public Func Application { get; set; }
+ public RequestDelegate Application { get; set; }
public MemoryPool2 Memory2 { get; set; }
}
diff --git a/src/Microsoft.AspNet.Server.Kestrel/Http/ListenerPrimary.cs b/src/Microsoft.AspNet.Server.Kestrel/Http/ListenerPrimary.cs
index 41aeeb3bfa..21c6c55183 100644
--- a/src/Microsoft.AspNet.Server.Kestrel/Http/ListenerPrimary.cs
+++ b/src/Microsoft.AspNet.Server.Kestrel/Http/ListenerPrimary.cs
@@ -4,6 +4,7 @@
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
+using Microsoft.AspNet.Http;
using Microsoft.AspNet.Server.Kestrel.Infrastructure;
using Microsoft.AspNet.Server.Kestrel.Networking;
using Microsoft.Extensions.Logging;
@@ -33,7 +34,7 @@ namespace Microsoft.AspNet.Server.Kestrel.Http
string pipeName,
ServerAddress address,
KestrelThread thread,
- Func application)
+ RequestDelegate application)
{
await StartAsync(address, thread, application).ConfigureAwait(false);
diff --git a/src/Microsoft.AspNet.Server.Kestrel/Http/ListenerSecondary.cs b/src/Microsoft.AspNet.Server.Kestrel/Http/ListenerSecondary.cs
index a348970737..814ea3ffe3 100644
--- a/src/Microsoft.AspNet.Server.Kestrel/Http/ListenerSecondary.cs
+++ b/src/Microsoft.AspNet.Server.Kestrel/Http/ListenerSecondary.cs
@@ -4,6 +4,7 @@
using System;
using System.Runtime.InteropServices;
using System.Threading.Tasks;
+using Microsoft.AspNet.Http;
using Microsoft.AspNet.Server.Kestrel.Infrastructure;
using Microsoft.AspNet.Server.Kestrel.Networking;
using Microsoft.Extensions.Logging;
@@ -26,7 +27,7 @@ namespace Microsoft.AspNet.Server.Kestrel.Http
string pipeName,
ServerAddress address,
KestrelThread thread,
- Func application)
+ RequestDelegate application)
{
ServerAddress = address;
Thread = thread;
diff --git a/src/Microsoft.AspNet.Server.Kestrel/KestrelEngine.cs b/src/Microsoft.AspNet.Server.Kestrel/KestrelEngine.cs
index 32dd5dab98..b0150cad1d 100644
--- a/src/Microsoft.AspNet.Server.Kestrel/KestrelEngine.cs
+++ b/src/Microsoft.AspNet.Server.Kestrel/KestrelEngine.cs
@@ -3,8 +3,7 @@
using System;
using System.Collections.Generic;
-using System.Threading.Tasks;
-using Microsoft.AspNet.Http.Features;
+using Microsoft.AspNet.Http;
using Microsoft.AspNet.Server.Kestrel.Http;
using Microsoft.AspNet.Server.Kestrel.Networking;
@@ -49,7 +48,7 @@ namespace Microsoft.AspNet.Server.Kestrel
Threads.Clear();
}
- public IDisposable CreateServer(ServerAddress address, Func application)
+ public IDisposable CreateServer(ServerAddress address, RequestDelegate application)
{
var listeners = new List();
diff --git a/src/Microsoft.AspNet.Server.Kestrel/KestrelServer.cs b/src/Microsoft.AspNet.Server.Kestrel/KestrelServer.cs
new file mode 100644
index 0000000000..ff0ca62422
--- /dev/null
+++ b/src/Microsoft.AspNet.Server.Kestrel/KestrelServer.cs
@@ -0,0 +1,128 @@
+// Copyright (c) .NET Foundation. All rights reserved.
+// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
+
+using System;
+using System.Collections.Generic;
+using Microsoft.AspNet.Hosting;
+using Microsoft.AspNet.Hosting.Server;
+using Microsoft.AspNet.Http;
+using Microsoft.AspNet.Http.Features;
+using Microsoft.AspNet.Server.Kestrel.Http;
+using Microsoft.Extensions.Logging;
+
+namespace Microsoft.AspNet.Server.Kestrel
+{
+ public class KestrelServer : IServer
+ {
+ private Stack _disposables;
+ private readonly IApplicationLifetime _applicationLifetime;
+ private readonly ILogger _logger;
+ private readonly IHttpContextFactory _httpContextFactory;
+
+ public KestrelServer(IFeatureCollection features, IApplicationLifetime applicationLifetime, ILogger logger, IHttpContextFactory httpContextFactory)
+ {
+ if (features == null)
+ {
+ throw new ArgumentNullException(nameof(features));
+ }
+
+ if (applicationLifetime == null)
+ {
+ throw new ArgumentNullException(nameof(applicationLifetime));
+ }
+
+ if (logger == null)
+ {
+ throw new ArgumentNullException(nameof(logger));
+ }
+
+ if (httpContextFactory == null)
+ {
+ throw new ArgumentNullException(nameof(httpContextFactory));
+ }
+
+ _applicationLifetime = applicationLifetime;
+ _logger = logger;
+ Features = features;
+ _httpContextFactory = httpContextFactory;
+ }
+
+ public IFeatureCollection Features { get; }
+
+ public void Start(RequestDelegate requestDelegate)
+ {
+ if (_disposables != null)
+ {
+ // The server has already started and/or has not been cleaned up yet
+ throw new InvalidOperationException("Server has already started.");
+ }
+ _disposables = new Stack();
+
+ try
+ {
+ var information = (KestrelServerInformation)Features.Get();
+ var dateHeaderValueManager = new DateHeaderValueManager();
+ var engine = new KestrelEngine(new ServiceContext
+ {
+ AppLifetime = _applicationLifetime,
+ Log = new KestrelTrace(_logger),
+ HttpContextFactory = _httpContextFactory,
+ DateHeaderValueManager = dateHeaderValueManager,
+ ConnectionFilter = information.ConnectionFilter,
+ NoDelay = information.NoDelay
+ });
+
+ _disposables.Push(engine);
+ _disposables.Push(dateHeaderValueManager);
+
+ if (information.ThreadCount < 0)
+ {
+ throw new ArgumentOutOfRangeException(nameof(information.ThreadCount),
+ information.ThreadCount,
+ "ThreadCount cannot be negative");
+ }
+
+ engine.Start(information.ThreadCount == 0 ? 1 : information.ThreadCount);
+ var atLeastOneListener = false;
+
+ foreach (var address in information.Addresses)
+ {
+ var parsedAddress = ServerAddress.FromUrl(address);
+ if (parsedAddress == null)
+ {
+ throw new FormatException("Unrecognized listening address: " + address);
+ }
+ else
+ {
+ atLeastOneListener = true;
+ _disposables.Push(engine.CreateServer(
+ parsedAddress,
+ requestDelegate));
+ }
+ }
+
+ if (!atLeastOneListener)
+ {
+ throw new InvalidOperationException("No recognized listening addresses were configured.");
+ }
+ }
+ catch
+ {
+ Dispose();
+ throw;
+ }
+ }
+
+ public void Dispose()
+ {
+ if (_disposables != null)
+ {
+ while (_disposables.Count > 0)
+ {
+ _disposables.Pop().Dispose();
+ }
+ _disposables = null;
+ }
+ }
+ }
+}
diff --git a/src/Microsoft.AspNet.Server.Kestrel/ServerFactory.cs b/src/Microsoft.AspNet.Server.Kestrel/ServerFactory.cs
index c0b42c0d2c..158e089fee 100644
--- a/src/Microsoft.AspNet.Server.Kestrel/ServerFactory.cs
+++ b/src/Microsoft.AspNet.Server.Kestrel/ServerFactory.cs
@@ -1,14 +1,11 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
-using System;
-using System.Collections.Generic;
-using System.Threading.Tasks;
using Microsoft.AspNet.Hosting;
using Microsoft.AspNet.Hosting.Server;
+using Microsoft.AspNet.Http;
using Microsoft.AspNet.Http.Features;
using Microsoft.AspNet.Server.Features;
-using Microsoft.AspNet.Server.Kestrel.Http;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Logging;
@@ -20,89 +17,24 @@ namespace Microsoft.AspNet.Server.Kestrel
public class ServerFactory : IServerFactory
{
private readonly IApplicationLifetime _appLifetime;
- private readonly ILogger _logger;
+ private readonly ILoggerFactory _loggerFactory;
+ private readonly IHttpContextFactory _httpContextFactory;
- public ServerFactory(IApplicationLifetime appLifetime, ILoggerFactory loggerFactory)
+ public ServerFactory(IApplicationLifetime appLifetime, ILoggerFactory loggerFactory, IHttpContextFactory httpContextFactory)
{
_appLifetime = appLifetime;
- _logger = loggerFactory.CreateLogger("Microsoft.AspNet.Server.Kestrel");
+ _loggerFactory = loggerFactory;
+ _httpContextFactory = httpContextFactory;
}
- public IFeatureCollection Initialize(IConfiguration configuration)
+ public IServer CreateServer(IConfiguration configuration)
{
var information = new KestrelServerInformation();
information.Initialize(configuration);
var serverFeatures = new FeatureCollection();
serverFeatures.Set(information);
serverFeatures.Set(information);
- return serverFeatures;
- }
-
- public IDisposable Start(IFeatureCollection serverFeatures, Func application)
- {
- var disposables = new Stack();
- var disposer = new Disposable(() =>
- {
- foreach (var disposable in disposables)
- {
- disposable.Dispose();
- }
- });
-
- try
- {
- var information = (KestrelServerInformation)serverFeatures.Get();
- var dateHeaderValueManager = new DateHeaderValueManager();
- var engine = new KestrelEngine(new ServiceContext
- {
- AppLifetime = _appLifetime,
- Log = new KestrelTrace(_logger),
- DateHeaderValueManager = dateHeaderValueManager,
- ConnectionFilter = information.ConnectionFilter,
- NoDelay = information.NoDelay
- });
-
- disposables.Push(engine);
- disposables.Push(dateHeaderValueManager);
-
- if (information.ThreadCount < 0)
- {
- throw new ArgumentOutOfRangeException(nameof(information.ThreadCount),
- information.ThreadCount,
- "ThreadCount cannot be negative");
- }
-
- engine.Start(information.ThreadCount == 0 ? 1 : information.ThreadCount);
- bool atLeastOneListener = false;
-
- foreach (var address in information.Addresses)
- {
- var parsedAddress = ServerAddress.FromUrl(address);
- if (parsedAddress == null)
- {
- throw new FormatException("Unrecognized listening address: " + address);
- }
- else
- {
- atLeastOneListener = true;
- disposables.Push(engine.CreateServer(
- parsedAddress,
- application));
- }
- }
-
- if (!atLeastOneListener)
- {
- throw new InvalidOperationException("No recognized listening addresses were configured.");
- }
-
- return disposer;
- }
- catch
- {
- disposer.Dispose();
- throw;
- }
+ return new KestrelServer(serverFeatures, _appLifetime, _loggerFactory.CreateLogger("Microsoft.AspNet.Server.Kestrel"), _httpContextFactory);
}
}
}
diff --git a/src/Microsoft.AspNet.Server.Kestrel/ServiceContext.cs b/src/Microsoft.AspNet.Server.Kestrel/ServiceContext.cs
index 35086de40d..d3d1539a59 100644
--- a/src/Microsoft.AspNet.Server.Kestrel/ServiceContext.cs
+++ b/src/Microsoft.AspNet.Server.Kestrel/ServiceContext.cs
@@ -2,6 +2,7 @@
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using Microsoft.AspNet.Hosting;
+using Microsoft.AspNet.Http;
using Microsoft.AspNet.Server.Kestrel.Filter;
using Microsoft.AspNet.Server.Kestrel.Http;
using Microsoft.AspNet.Server.Kestrel.Infrastructure;
@@ -20,6 +21,7 @@ namespace Microsoft.AspNet.Server.Kestrel
AppLifetime = context.AppLifetime;
Memory = context.Memory;
Log = context.Log;
+ HttpContextFactory = context.HttpContextFactory;
DateHeaderValueManager = context.DateHeaderValueManager;
ConnectionFilter = context.ConnectionFilter;
NoDelay = context.NoDelay;
@@ -31,6 +33,8 @@ namespace Microsoft.AspNet.Server.Kestrel
public IKestrelTrace Log { get; set; }
+ public IHttpContextFactory HttpContextFactory { get; set; }
+
public DateHeaderValueManager DateHeaderValueManager { get; set; }
public IConnectionFilter ConnectionFilter { get; set; }
diff --git a/test/Microsoft.AspNet.Server.Kestrel.FunctionalTests/AddressRegistrationTests.cs b/test/Microsoft.AspNet.Server.Kestrel.FunctionalTests/AddressRegistrationTests.cs
index cabb74761b..00f6db432d 100644
--- a/test/Microsoft.AspNet.Server.Kestrel.FunctionalTests/AddressRegistrationTests.cs
+++ b/test/Microsoft.AspNet.Server.Kestrel.FunctionalTests/AddressRegistrationTests.cs
@@ -26,7 +26,7 @@ namespace Microsoft.AspNet.Server.Kestrel.FunctionalTests
.Build();
var hostBuilder = new WebHostBuilder(config);
- hostBuilder.UseServer("Microsoft.AspNet.Server.Kestrel");
+ hostBuilder.UseServerFactory("Microsoft.AspNet.Server.Kestrel");
hostBuilder.UseStartup(ConfigureEchoAddress);
using (var app = hostBuilder.Build().Start())
diff --git a/test/Microsoft.AspNet.Server.Kestrel.FunctionalTests/RequestTests.cs b/test/Microsoft.AspNet.Server.Kestrel.FunctionalTests/RequestTests.cs
index f90429cf91..99e0c067cf 100644
--- a/test/Microsoft.AspNet.Server.Kestrel.FunctionalTests/RequestTests.cs
+++ b/test/Microsoft.AspNet.Server.Kestrel.FunctionalTests/RequestTests.cs
@@ -28,7 +28,7 @@ namespace Microsoft.AspNet.Server.Kestrel.FunctionalTests
.Build();
var hostBuilder = new WebHostBuilder(config);
- hostBuilder.UseServer("Microsoft.AspNet.Server.Kestrel");
+ hostBuilder.UseServerFactory("Microsoft.AspNet.Server.Kestrel");
hostBuilder.UseStartup(app =>
{
app.Run(async context =>
diff --git a/test/Microsoft.AspNet.Server.Kestrel.FunctionalTests/ResponseTests.cs b/test/Microsoft.AspNet.Server.Kestrel.FunctionalTests/ResponseTests.cs
index 54216dcdb8..245729d94e 100644
--- a/test/Microsoft.AspNet.Server.Kestrel.FunctionalTests/ResponseTests.cs
+++ b/test/Microsoft.AspNet.Server.Kestrel.FunctionalTests/ResponseTests.cs
@@ -24,7 +24,7 @@ namespace Microsoft.AspNet.Server.Kestrel.FunctionalTests
.Build();
var hostBuilder = new WebHostBuilder(config);
- hostBuilder.UseServer("Microsoft.AspNet.Server.Kestrel");
+ hostBuilder.UseServerFactory("Microsoft.AspNet.Server.Kestrel");
hostBuilder.UseStartup(app =>
{
app.Run(async context =>
diff --git a/test/Microsoft.AspNet.Server.Kestrel.FunctionalTests/ThreadCountTests.cs b/test/Microsoft.AspNet.Server.Kestrel.FunctionalTests/ThreadCountTests.cs
index dabe7c4abe..ea654651e3 100644
--- a/test/Microsoft.AspNet.Server.Kestrel.FunctionalTests/ThreadCountTests.cs
+++ b/test/Microsoft.AspNet.Server.Kestrel.FunctionalTests/ThreadCountTests.cs
@@ -26,7 +26,7 @@ namespace Microsoft.AspNet.Server.Kestrel.FunctionalTests
.Build();
var hostBuilder = new WebHostBuilder(config);
- hostBuilder.UseServer("Microsoft.AspNet.Server.Kestrel");
+ hostBuilder.UseServerFactory("Microsoft.AspNet.Server.Kestrel");
hostBuilder.UseStartup(app =>
{
var serverInfo = app.ServerFeatures.Get();
diff --git a/test/Microsoft.AspNet.Server.KestrelTests/ChunkedResponseTests.cs b/test/Microsoft.AspNet.Server.KestrelTests/ChunkedResponseTests.cs
index d84bf41df1..ca01df5f41 100644
--- a/test/Microsoft.AspNet.Server.KestrelTests/ChunkedResponseTests.cs
+++ b/test/Microsoft.AspNet.Server.KestrelTests/ChunkedResponseTests.cs
@@ -4,7 +4,6 @@
using System;
using System.Text;
using System.Threading.Tasks;
-using Microsoft.AspNet.Http.Features;
using Xunit;
namespace Microsoft.AspNet.Server.KestrelTests
@@ -14,9 +13,9 @@ namespace Microsoft.AspNet.Server.KestrelTests
[Fact]
public async Task ResponsesAreChunkedAutomatically()
{
- using (var server = new TestServer(async frame =>
+ using (var server = new TestServer(async httpContext =>
{
- var response = frame.Get();
+ var response = httpContext.Response;
response.Headers.Clear();
await response.Body.WriteAsync(Encoding.ASCII.GetBytes("Hello "), 0, 6);
await response.Body.WriteAsync(Encoding.ASCII.GetBytes("World!"), 0, 6);
@@ -46,9 +45,9 @@ namespace Microsoft.AspNet.Server.KestrelTests
[Fact]
public async Task ZeroLengthWritesAreIgnored()
{
- using (var server = new TestServer(async frame =>
+ using (var server = new TestServer(async httpContext =>
{
- var response = frame.Get();
+ var response = httpContext.Response;
response.Headers.Clear();
await response.Body.WriteAsync(Encoding.ASCII.GetBytes("Hello "), 0, 6);
await response.Body.WriteAsync(new byte[0], 0, 0);
@@ -79,9 +78,9 @@ namespace Microsoft.AspNet.Server.KestrelTests
[Fact]
public async Task EmptyResponseBodyHandledCorrectlyWithZeroLengthWrite()
{
- using (var server = new TestServer(async frame =>
+ using (var server = new TestServer(async httpContext =>
{
- var response = frame.Get();
+ var response = httpContext.Response;
response.Headers.Clear();
await response.Body.WriteAsync(new byte[0], 0, 0);
}))
@@ -106,9 +105,9 @@ namespace Microsoft.AspNet.Server.KestrelTests
[Fact]
public async Task ConnectionClosedIfExeptionThrownAfterWrite()
{
- using (var server = new TestServer(async frame =>
+ using (var server = new TestServer(async httpContext =>
{
- var response = frame.Get();
+ var response = httpContext.Response;
response.Headers.Clear();
await response.Body.WriteAsync(Encoding.ASCII.GetBytes("Hello World!"), 0, 12);
throw new Exception();
@@ -136,9 +135,9 @@ namespace Microsoft.AspNet.Server.KestrelTests
[Fact]
public async Task ConnectionClosedIfExeptionThrownAfterZeroLengthWrite()
{
- using (var server = new TestServer(async frame =>
+ using (var server = new TestServer(async httpContext =>
{
- var response = frame.Get();
+ var response = httpContext.Response;
response.Headers.Clear();
await response.Body.WriteAsync(new byte[0], 0, 0);
throw new Exception();
diff --git a/test/Microsoft.AspNet.Server.KestrelTests/ConnectionFilterTests.cs b/test/Microsoft.AspNet.Server.KestrelTests/ConnectionFilterTests.cs
index b37d72a6e2..d4dfc5fe9b 100644
--- a/test/Microsoft.AspNet.Server.KestrelTests/ConnectionFilterTests.cs
+++ b/test/Microsoft.AspNet.Server.KestrelTests/ConnectionFilterTests.cs
@@ -4,7 +4,7 @@
using System.IO;
using System.Threading.Tasks;
using Microsoft.AspNet.Server.Kestrel.Filter;
-using Microsoft.AspNet.Server.Kestrel.Http;
+using Microsoft.AspNet.Http;
using Microsoft.AspNet.Http.Features;
using Xunit;
@@ -12,10 +12,10 @@ namespace Microsoft.AspNet.Server.KestrelTests
{
public class ConnectionFilterTests
{
- private async Task App(IFeatureCollection frame)
+ private async Task App(HttpContext httpContext)
{
- var request = frame.Get();
- var response = frame.Get();
+ var request = httpContext.Request;
+ var response = httpContext.Response;
response.Headers.Clear();
while (true)
{
diff --git a/test/Microsoft.AspNet.Server.KestrelTests/EngineTests.cs b/test/Microsoft.AspNet.Server.KestrelTests/EngineTests.cs
index 1d2cba53c0..299ba25fe6 100644
--- a/test/Microsoft.AspNet.Server.KestrelTests/EngineTests.cs
+++ b/test/Microsoft.AspNet.Server.KestrelTests/EngineTests.cs
@@ -7,7 +7,7 @@ using System.Net;
using System.Net.Sockets;
using System.Text;
using System.Threading.Tasks;
-using Microsoft.AspNet.Http.Features;
+using Microsoft.AspNet.Http;
using Microsoft.AspNet.Server.Kestrel;
using Microsoft.AspNet.Server.Kestrel.Filter;
using Microsoft.Extensions.Logging;
@@ -39,10 +39,10 @@ namespace Microsoft.AspNet.Server.KestrelTests
}
}
- private async Task App(IFeatureCollection frame)
+ private async Task App(HttpContext httpContext)
{
- var request = frame.Get();
- var response = frame.Get();
+ var request = httpContext.Request;
+ var response = httpContext.Response;
response.Headers.Clear();
while (true)
{
@@ -56,10 +56,10 @@ namespace Microsoft.AspNet.Server.KestrelTests
}
}
- private async Task AppChunked(IFeatureCollection frame)
+ private async Task AppChunked(HttpContext httpContext)
{
- var request = frame.Get();
- var response = frame.Get();
+ var request = httpContext.Request;
+ var response = httpContext.Response;
var data = new MemoryStream();
await request.Body.CopyToAsync(data);
var bytes = data.ToArray();
@@ -69,9 +69,9 @@ namespace Microsoft.AspNet.Server.KestrelTests
await response.Body.WriteAsync(bytes, 0, bytes.Length);
}
- private Task EmptyApp(IFeatureCollection frame)
+ private Task EmptyApp(HttpContext httpContext)
{
- frame.Get().Headers.Clear();
+ httpContext.Response.Headers.Clear();
return Task.FromResult