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

Commit 5e7b30c

Browse files
committed
#542 Add IHttpConnectionFeature.ConnectionId
1 parent 8c120a0 commit 5e7b30c

File tree

5 files changed

+35
-0
lines changed

5 files changed

+35
-0
lines changed

src/Microsoft.AspNetCore.Http.Features/IHttpConnectionFeature.cs

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,34 @@
55

66
namespace Microsoft.AspNetCore.Http.Features
77
{
8+
/// <summary>
9+
/// Information regarding the TCP/IP connection carrying the request.
10+
/// </summary>
811
public interface IHttpConnectionFeature
912
{
13+
/// <summary>
14+
/// The unique identifier for the connection the request was received on. This is primarily for diagnostic purposes.
15+
/// </summary>
16+
string ConnectionId { get; set; }
17+
18+
/// <summary>
19+
/// The IPAddress of the client making the request. Note this may be for a proxy rather than the end user.
20+
/// </summary>
1021
IPAddress RemoteIpAddress { get; set; }
22+
23+
/// <summary>
24+
/// The local IPAddress on which the request was received.
25+
/// </summary>
1126
IPAddress LocalIpAddress { get; set; }
27+
28+
/// <summary>
29+
/// The remote port of the client making the request.
30+
/// </summary>
1231
int RemotePort { get; set; }
32+
33+
/// <summary>
34+
/// The local port on which the request was received.
35+
/// </summary>
1336
int LocalPort { get; set; }
1437
}
1538
}

src/Microsoft.AspNetCore.Http/Features/HttpConnectionFeature.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ public HttpConnectionFeature()
1111
{
1212
}
1313

14+
public string ConnectionId { get; set; }
15+
1416
public IPAddress LocalIpAddress { get; set; }
1517

1618
public int LocalPort { get; set; }

src/Microsoft.AspNetCore.Owin/OwinConstants.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ internal static class CommonKeys
7373
public const string RemotePort = "server.RemotePort";
7474
public const string LocalIpAddress = "server.LocalIpAddress";
7575
public const string LocalPort = "server.LocalPort";
76+
public const string ConnectionId = "server.ConnectionId";
7677
public const string TraceOutput = "host.TraceOutput";
7778
public const string Addresses = "host.Addresses";
7879
public const string AppName = "host.AppName";

src/Microsoft.AspNetCore.Owin/OwinEnvironment.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,9 @@ public OwinEnvironment(HttpContext context)
7474
}))
7575
},
7676

77+
{ OwinConstants.CommonKeys.ConnectionId, new FeatureMap<IHttpConnectionFeature>(feature => feature.ConnectionId,
78+
(feature, value) => feature.ConnectionId = Convert.ToString(value, CultureInfo.InvariantCulture)) },
79+
7780
{ OwinConstants.CommonKeys.LocalPort, new FeatureMap<IHttpConnectionFeature>(feature => feature.LocalPort.ToString(CultureInfo.InvariantCulture),
7881
(feature, value) => feature.LocalPort = Convert.ToInt32(value, CultureInfo.InvariantCulture)) },
7982
{ OwinConstants.CommonKeys.RemotePort, new FeatureMap<IHttpConnectionFeature>(feature => feature.RemotePort.ToString(CultureInfo.InvariantCulture),

src/Microsoft.AspNetCore.Owin/OwinFeatureCollection.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,12 @@ int IHttpConnectionFeature.LocalPort
190190
set { Prop(OwinConstants.CommonKeys.LocalPort, value.ToString(CultureInfo.InvariantCulture)); }
191191
}
192192

193+
string IHttpConnectionFeature.ConnectionId
194+
{
195+
get { return Prop<string>(OwinConstants.CommonKeys.ConnectionId); }
196+
set { Prop(OwinConstants.CommonKeys.ConnectionId, value); }
197+
}
198+
193199
private bool SupportsSendFile
194200
{
195201
get

0 commit comments

Comments
 (0)