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

Commit 91436f2

Browse files
committed
HttpAbstractions changes
1 parent 7921894 commit 91436f2

File tree

6 files changed

+10
-132
lines changed

6 files changed

+10
-132
lines changed

src/Microsoft.AspNet.Hosting/Internal/FastHttpRequestIdentifierFeature.cs

Lines changed: 0 additions & 65 deletions
This file was deleted.

src/Microsoft.AspNet.Hosting/Internal/HostingEngine.cs

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -278,18 +278,6 @@ private void EnsureServer()
278278
}
279279
}
280280

281-
private string GetRequestIdentifier(HttpContext httpContext)
282-
{
283-
var requestIdentifierFeature = httpContext.Features.Get<IHttpRequestIdentifierFeature>();
284-
if (requestIdentifierFeature == null)
285-
{
286-
requestIdentifierFeature = new FastHttpRequestIdentifierFeature();
287-
httpContext.Features.Set(requestIdentifierFeature);
288-
}
289-
290-
return requestIdentifierFeature.TraceIdentifier;
291-
}
292-
293281
private class Disposable : IDisposable
294282
{
295283
private Action _dispose;

src/Microsoft.AspNet.Hosting/Internal/HostingLoggerExtensions.cs

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
using System.Collections.Generic;
66
using System.Threading;
77
using Microsoft.AspNet.Http;
8-
using Microsoft.AspNet.Http.Features;
98
using Microsoft.Extensions.Logging;
109

1110
namespace Microsoft.AspNet.Hosting.Internal
@@ -37,7 +36,6 @@ private class HostingRequestScope : ILogValues
3736
{
3837
private readonly HttpContext _httpContext;
3938

40-
private FeatureReference<IHttpRequestIdentifierFeature> _requestIdentifierFeatureReference;
4139
private IEnumerable<KeyValuePair<string, object>> _cachedGetValues;
4240
private string _cachedToString;
4341

@@ -46,20 +44,16 @@ public HostingRequestScope(HttpContext httpContext)
4644
this._httpContext = httpContext;
4745
}
4846

49-
public IHttpRequestIdentifierFeature RequestIdFeature =>
50-
_requestIdentifierFeatureReference.Fetch(_httpContext.Features) ??
51-
_requestIdentifierFeatureReference.Update(_httpContext.Features, new FastHttpRequestIdentifierFeature());
52-
5347
public override string ToString() => _cachedToString ?? Interlocked.CompareExchange(
5448
ref _cachedToString,
55-
$"RequestId:{RequestIdFeature.TraceIdentifier} RequestPath:{_httpContext.Request.Path}",
49+
$"RequestId:{_httpContext.TraceIdentifier} RequestPath:{_httpContext.Request.Path}",
5650
null);
5751

5852
public IEnumerable<KeyValuePair<string, object>> GetValues() => _cachedGetValues ?? Interlocked.CompareExchange(
5953
ref _cachedGetValues,
6054
new[]
6155
{
62-
new KeyValuePair<string, object>("RequestId", RequestIdFeature.TraceIdentifier),
56+
new KeyValuePair<string, object>("RequestId", _httpContext.TraceIdentifier),
6357
new KeyValuePair<string, object>("RequestPath", _httpContext.Request.Path.ToString()),
6458
},
6559
null);

src/Microsoft.AspNet.Hosting/project.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@
66
"url": "git://github.com/aspnet/hosting"
77
},
88
"compilationOptions": {
9-
"warningsAsErrors": true,
10-
"allowUnsafe": true
9+
"warningsAsErrors": true
1110
},
1211
"dependencies": {
1312
"Microsoft.AspNet.FileProviders.Physical": "1.0.0-*",

test/Microsoft.AspNet.Hosting.Tests/HostingEngineTests.cs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,13 @@ public void HostingEngine_CreatesDefaultRequestIdentifierFeature_IfNotPresent()
306306

307307
// Assert
308308
Assert.NotNull(httpContext);
309-
Assert.IsType<FastHttpRequestIdentifierFeature>(httpContext.Features.Get<IHttpRequestIdentifierFeature>());
309+
Assert.IsType<HttpRequestIdentifierFeature>(httpContext.Features.Get<IHttpRequestIdentifierFeature>());
310+
311+
Assert.NotNull(httpContext.TraceIdentifier);
312+
Assert.NotNull(httpContext.Features.Get<IHttpRequestIdentifierFeature>());
313+
314+
Assert.Same(httpContext.TraceIdentifier, httpContext.Features.Get<IHttpRequestIdentifierFeature>().TraceIdentifier);
315+
310316
}
311317

312318
[Fact]

test/Microsoft.AspNet.Hosting.Tests/Internal/FastHttpRequestIdentifierFeatureTests.cs

Lines changed: 0 additions & 44 deletions
This file was deleted.

0 commit comments

Comments
 (0)