diff --git a/src/Microsoft.AspNet.Server.Kestrel/Http/Frame.cs b/src/Microsoft.AspNet.Server.Kestrel/Http/Frame.cs
index 5bbb1db8a1..080aae8d2b 100644
--- a/src/Microsoft.AspNet.Server.Kestrel/Http/Frame.cs
+++ b/src/Microsoft.AspNet.Server.Kestrel/Http/Frame.cs
@@ -614,9 +614,9 @@ namespace Microsoft.AspNet.Server.Kestrel.Http
chFirst = scan.Take(); // expecting: /r
chSecond = scan.Take(); // expecting: /n
- if (chSecond == '\r')
+ if (chSecond != '\n')
{
- // special case, "\r\r". move to the 2nd "\r" and try again
+ // "\r" was all by itself, move just after it and try again
scan = endValue;
scan.Take();
continue;
@@ -633,6 +633,9 @@ namespace Microsoft.AspNet.Server.Kestrel.Http
}
var name = beginName.GetArraySegment(endName);
+#if DEBUG
+ var nameString = beginName.GetString(endName);
+#endif
var value = beginValue.GetString(endValue);
if (wrapping)
{
diff --git a/src/Microsoft.AspNet.Server.Kestrel/Http/Listener.cs b/src/Microsoft.AspNet.Server.Kestrel/Http/Listener.cs
index 9cf57b5b4a..a828d4d17a 100644
--- a/src/Microsoft.AspNet.Server.Kestrel/Http/Listener.cs
+++ b/src/Microsoft.AspNet.Server.Kestrel/Http/Listener.cs
@@ -13,7 +13,8 @@ namespace Microsoft.AspNet.Server.Kestrel.Http
///
public abstract class Listener : ListenerContext, IDisposable
{
- protected Listener(ServiceContext serviceContext) : base(serviceContext)
+ protected Listener(ServiceContext serviceContext)
+ : base(serviceContext)
{
Memory2 = new MemoryPool2();
}
diff --git a/src/Microsoft.AspNet.Server.Kestrel/Http/ListenerContext.cs b/src/Microsoft.AspNet.Server.Kestrel/Http/ListenerContext.cs
index d7e8d1f022..03d27501d6 100644
--- a/src/Microsoft.AspNet.Server.Kestrel/Http/ListenerContext.cs
+++ b/src/Microsoft.AspNet.Server.Kestrel/Http/ListenerContext.cs
@@ -7,17 +7,19 @@ using Microsoft.AspNet.Server.Kestrel.Infrastructure;
namespace Microsoft.AspNet.Server.Kestrel.Http
{
- public class ListenerContext
+ public class ListenerContext : ServiceContext
{
- public ListenerContext() { }
-
- public ListenerContext(ServiceContext serviceContext)
+ public ListenerContext()
+ {
+ }
+
+ public ListenerContext(ServiceContext serviceContext)
+ : base(serviceContext)
{
- Memory = serviceContext.Memory;
- Log = serviceContext.Log;
}
public ListenerContext(ListenerContext listenerContext)
+ : base(listenerContext)
{
Thread = listenerContext.Thread;
Application = listenerContext.Application;
@@ -30,10 +32,6 @@ namespace Microsoft.AspNet.Server.Kestrel.Http
public Func Application { get; set; }
- public IMemoryPool Memory { get; set; }
-
public MemoryPool2 Memory2 { get; set; }
-
- public IKestrelTrace Log { get; }
}
-}
\ No newline at end of file
+}
diff --git a/src/Microsoft.AspNet.Server.Kestrel/Infrastructure/KestrelThread.cs b/src/Microsoft.AspNet.Server.Kestrel/Infrastructure/KestrelThread.cs
index 85683f2db1..b059bf6fe0 100644
--- a/src/Microsoft.AspNet.Server.Kestrel/Infrastructure/KestrelThread.cs
+++ b/src/Microsoft.AspNet.Server.Kestrel/Infrastructure/KestrelThread.cs
@@ -33,11 +33,11 @@ namespace Microsoft.AspNet.Server.Kestrel
private ExceptionDispatchInfo _closeError;
private IKestrelTrace _log;
- public KestrelThread(KestrelEngine engine, ServiceContext serviceContext)
+ public KestrelThread(KestrelEngine engine)
{
_engine = engine;
- _appShutdown = serviceContext.AppShutdown;
- _log = serviceContext.Log;
+ _appShutdown = engine.AppShutdown;
+ _log = engine.Log;
_loop = new UvLoopHandle(_log);
_post = new UvAsyncHandle(_log);
_thread = new Thread(ThreadStart);
diff --git a/src/Microsoft.AspNet.Server.Kestrel/Infrastructure/KestrelTrace.cs b/src/Microsoft.AspNet.Server.Kestrel/Infrastructure/KestrelTrace.cs
index 5fba4c7f01..b7cc35e5aa 100644
--- a/src/Microsoft.AspNet.Server.Kestrel/Infrastructure/KestrelTrace.cs
+++ b/src/Microsoft.AspNet.Server.Kestrel/Infrastructure/KestrelTrace.cs
@@ -12,87 +12,87 @@ namespace Microsoft.AspNet.Server.Kestrel
///
public class KestrelTrace : IKestrelTrace
{
- private readonly ILogger _logger;
+ protected readonly ILogger _logger;
public KestrelTrace(ILogger logger)
{
_logger = logger;
}
- public void ConnectionStart(long connectionId)
+ public virtual void ConnectionStart(long connectionId)
{
_logger.LogDebug(1, @"Connection id ""{ConnectionId}"" started.", connectionId);
}
- public void ConnectionStop(long connectionId)
+ public virtual void ConnectionStop(long connectionId)
{
_logger.LogDebug(2, @"Connection id ""{ConnectionId}"" stopped.", connectionId);
}
- public void ConnectionRead(long connectionId, int count)
+ public virtual void ConnectionRead(long connectionId, int count)
{
// Don't log for now since this could be *too* verbose.
// Reserved: Event ID 3
}
- public void ConnectionPause(long connectionId)
+ public virtual void ConnectionPause(long connectionId)
{
_logger.LogDebug(4, @"Connection id ""{ConnectionId}"" paused.", connectionId);
}
- public void ConnectionResume(long connectionId)
+ public virtual void ConnectionResume(long connectionId)
{
_logger.LogDebug(5, @"Connection id ""{ConnectionId}"" resumed.", connectionId);
}
- public void ConnectionReadFin(long connectionId)
+ public virtual void ConnectionReadFin(long connectionId)
{
_logger.LogDebug(6, @"Connection id ""{ConnectionId}"" received FIN.", connectionId);
}
- public void ConnectionWriteFin(long connectionId)
+ public virtual void ConnectionWriteFin(long connectionId)
{
_logger.LogDebug(7, @"Connection id ""{ConnectionId}"" sending FIN.", connectionId);
}
- public void ConnectionWroteFin(long connectionId, int status)
+ public virtual void ConnectionWroteFin(long connectionId, int status)
{
_logger.LogDebug(8, @"Connection id ""{ConnectionId}"" sent FIN with status ""{Status}"".", connectionId, status);
}
- public void ConnectionKeepAlive(long connectionId)
+ public virtual void ConnectionKeepAlive(long connectionId)
{
_logger.LogDebug(9, @"Connection id ""{ConnectionId}"" completed keep alive response.", connectionId);
}
- public void ConnectionDisconnect(long connectionId)
+ public virtual void ConnectionDisconnect(long connectionId)
{
_logger.LogDebug(10, @"Connection id ""{ConnectionId}"" disconnected.", connectionId);
}
- public void ConnectionWrite(long connectionId, int count)
+ public virtual void ConnectionWrite(long connectionId, int count)
{
// Don't log for now since this could be *too* verbose.
// Reserved: Event ID 11
}
- public void ConnectionWriteCallback(long connectionId, int status)
+ public virtual void ConnectionWriteCallback(long connectionId, int status)
{
// Don't log for now since this could be *too* verbose.
// Reserved: Event ID 12
}
- public void Log(LogLevel logLevel, int eventId, object state, Exception exception, Func