React to IRequestIdentifierFeature refactor.

This commit is contained in:
Chris R 2015-06-18 15:55:12 -07:00
parent cdf8072c83
commit 03f7e4b362
2 changed files with 13 additions and 7 deletions

View File

@ -45,7 +45,7 @@ namespace Microsoft.AspNet.Server.WebListener
IHttpWebSocketFeature,
IHttpAuthenticationFeature,
IHttpUpgradeFeature,
IRequestIdentifierFeature
IHttpRequestIdentifierFeature
{
private static Action<object> OnStartDelegate = OnStart;
@ -66,6 +66,7 @@ namespace Microsoft.AspNet.Server.WebListener
private int? _remotePort;
private int? _localPort;
private bool? _isLocal;
private string _requestId;
private X509Certificate2 _clientCert;
private ClaimsPrincipal _user;
private IAuthenticationHandler _authHandler;
@ -107,7 +108,7 @@ namespace Microsoft.AspNet.Server.WebListener
_features.Add(typeof(IHttpBufferingFeature), this);
_features.Add(typeof(IHttpRequestLifetimeFeature), this);
_features.Add(typeof(IHttpAuthenticationFeature), this);
_features.Add(typeof(IRequestIdentifierFeature), this);
_features.Add(typeof(IHttpRequestIdentifierFeature), this);
if (Request.IsSecureConnection)
{
@ -470,12 +471,17 @@ namespace Microsoft.AspNet.Server.WebListener
set { _authHandler = value; }
}
Guid IRequestIdentifierFeature.TraceIdentifier
string IHttpRequestIdentifierFeature.TraceIdentifier
{
get
{
return _requestContext.TraceIdentifier;
if (_requestId == null)
{
_requestId = _requestContext.TraceIdentifier.ToString();
}
return _requestId;
}
set { _requestId = value; }
}
private static void OnStart(object obj)

View File

@ -64,7 +64,7 @@ namespace Microsoft.AspNet.Server.WebListener
Assert.True(connectionInfo.IsLocal);
// Trace identifier
var requestIdentifierFeature = httpContext.GetFeature<IRequestIdentifierFeature>();
var requestIdentifierFeature = httpContext.GetFeature<IHttpRequestIdentifierFeature>();
Assert.NotNull(requestIdentifierFeature);
Assert.NotNull(requestIdentifierFeature.TraceIdentifier);
@ -100,7 +100,7 @@ namespace Microsoft.AspNet.Server.WebListener
{
var requestInfo = httpContext.GetFeature<IHttpRequestFeature>();
var connectionInfo = httpContext.GetFeature<IHttpConnectionFeature>();
var requestIdentifierFeature = httpContext.GetFeature<IRequestIdentifierFeature>();
var requestIdentifierFeature = httpContext.GetFeature<IHttpRequestIdentifierFeature>();
// Request Keys
Assert.Equal("http", requestInfo.Scheme);
@ -145,7 +145,7 @@ namespace Microsoft.AspNet.Server.WebListener
{
var httpContext = new DefaultHttpContext((IFeatureCollection)env);
var requestInfo = httpContext.GetFeature<IHttpRequestFeature>();
var requestIdentifierFeature = httpContext.GetFeature<IRequestIdentifierFeature>();
var requestIdentifierFeature = httpContext.GetFeature<IHttpRequestIdentifierFeature>();
try
{
Assert.Equal(expectedPath, requestInfo.Path);