diff --git a/src/Microsoft.AspNetCore.Http.Features/IHttpConnectionFeature.cs b/src/Microsoft.AspNetCore.Http.Features/IHttpConnectionFeature.cs
index ac30742a..932e9bfe 100644
--- a/src/Microsoft.AspNetCore.Http.Features/IHttpConnectionFeature.cs
+++ b/src/Microsoft.AspNetCore.Http.Features/IHttpConnectionFeature.cs
@@ -5,11 +5,34 @@
namespace Microsoft.AspNetCore.Http.Features
{
+ ///
+ /// Information regarding the TCP/IP connection carrying the request.
+ ///
public interface IHttpConnectionFeature
{
+ ///
+ /// The unique identifier for the connection the request was received on. This is primarily for diagnostic purposes.
+ ///
+ string ConnectionId { get; set; }
+
+ ///
+ /// The IPAddress of the client making the request. Note this may be for a proxy rather than the end user.
+ ///
IPAddress RemoteIpAddress { get; set; }
+
+ ///
+ /// The local IPAddress on which the request was received.
+ ///
IPAddress LocalIpAddress { get; set; }
+
+ ///
+ /// The remote port of the client making the request.
+ ///
int RemotePort { get; set; }
+
+ ///
+ /// The local port on which the request was received.
+ ///
int LocalPort { get; set; }
}
}
\ No newline at end of file
diff --git a/src/Microsoft.AspNetCore.Http/Features/HttpConnectionFeature.cs b/src/Microsoft.AspNetCore.Http/Features/HttpConnectionFeature.cs
index 05fc485c..ab688ec7 100644
--- a/src/Microsoft.AspNetCore.Http/Features/HttpConnectionFeature.cs
+++ b/src/Microsoft.AspNetCore.Http/Features/HttpConnectionFeature.cs
@@ -11,6 +11,8 @@ public HttpConnectionFeature()
{
}
+ public string ConnectionId { get; set; }
+
public IPAddress LocalIpAddress { get; set; }
public int LocalPort { get; set; }
diff --git a/src/Microsoft.AspNetCore.Owin/OwinConstants.cs b/src/Microsoft.AspNetCore.Owin/OwinConstants.cs
index 028866ba..ca14cf9c 100644
--- a/src/Microsoft.AspNetCore.Owin/OwinConstants.cs
+++ b/src/Microsoft.AspNetCore.Owin/OwinConstants.cs
@@ -73,6 +73,7 @@ internal static class CommonKeys
public const string RemotePort = "server.RemotePort";
public const string LocalIpAddress = "server.LocalIpAddress";
public const string LocalPort = "server.LocalPort";
+ public const string ConnectionId = "server.ConnectionId";
public const string TraceOutput = "host.TraceOutput";
public const string Addresses = "host.Addresses";
public const string AppName = "host.AppName";
diff --git a/src/Microsoft.AspNetCore.Owin/OwinEnvironment.cs b/src/Microsoft.AspNetCore.Owin/OwinEnvironment.cs
index 11f3e2fa..a69bcde2 100644
--- a/src/Microsoft.AspNetCore.Owin/OwinEnvironment.cs
+++ b/src/Microsoft.AspNetCore.Owin/OwinEnvironment.cs
@@ -74,6 +74,9 @@ public OwinEnvironment(HttpContext context)
}))
},
+ { OwinConstants.CommonKeys.ConnectionId, new FeatureMap(feature => feature.ConnectionId,
+ (feature, value) => feature.ConnectionId = Convert.ToString(value, CultureInfo.InvariantCulture)) },
+
{ OwinConstants.CommonKeys.LocalPort, new FeatureMap(feature => feature.LocalPort.ToString(CultureInfo.InvariantCulture),
(feature, value) => feature.LocalPort = Convert.ToInt32(value, CultureInfo.InvariantCulture)) },
{ OwinConstants.CommonKeys.RemotePort, new FeatureMap(feature => feature.RemotePort.ToString(CultureInfo.InvariantCulture),
diff --git a/src/Microsoft.AspNetCore.Owin/OwinFeatureCollection.cs b/src/Microsoft.AspNetCore.Owin/OwinFeatureCollection.cs
index e2b7a8f8..6809d5c4 100644
--- a/src/Microsoft.AspNetCore.Owin/OwinFeatureCollection.cs
+++ b/src/Microsoft.AspNetCore.Owin/OwinFeatureCollection.cs
@@ -190,6 +190,12 @@ int IHttpConnectionFeature.LocalPort
set { Prop(OwinConstants.CommonKeys.LocalPort, value.ToString(CultureInfo.InvariantCulture)); }
}
+ string IHttpConnectionFeature.ConnectionId
+ {
+ get { return Prop(OwinConstants.CommonKeys.ConnectionId); }
+ set { Prop(OwinConstants.CommonKeys.ConnectionId, value); }
+ }
+
private bool SupportsSendFile
{
get