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

Commit

Permalink
Move some implementations (all feature implementations) out of `.Inte…
Browse files Browse the repository at this point in the history
…rnal` namespaces

- #549, #592
- move feature implementations to `Microsoft.AspNetCore.Http.Features` and `...Authentication.Features`
- move `DefaultHttpContext`, `HttpContextAccessor`, `HttpContextFactory`, `FormCollection` and
  `HeaderDictionary` to `Microsoft.AspNetCore.Http`
- move `FormFile` to `Microsoft.AspNetCore.Http.Internal`
 - that and `Microsoft.AspNetCore.Http.Authentication.Internal` are the remaining `.Internal` namespaces

nits:
- remove a couple of parameterless constructors
- add / fill subfolders to align with new namespaces
- remove all use of (unnecessary) "T:..." `<see cref=""/>` values
  • Loading branch information
dougbu committed Mar 30, 2016
1 parent ff0a37c commit 6725d68
Show file tree
Hide file tree
Showing 66 changed files with 128 additions and 175 deletions.
2 changes: 1 addition & 1 deletion samples/SampleApp/PooledHttpContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public class PooledHttpContext : DefaultHttpContext
DefaultHttpRequest _pooledHttpRequest;
DefaultHttpResponse _pooledHttpResponse;

public PooledHttpContext(IFeatureCollection featureCollection) :
public PooledHttpContext(IFeatureCollection featureCollection) :
base(featureCollection)
{
}
Expand Down
1 change: 0 additions & 1 deletion samples/SampleApp/PooledHttpContextFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
using System.Text;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Http.Features;
using Microsoft.AspNetCore.Http.Features.Internal;
using Microsoft.Extensions.ObjectPool;

namespace SampleApp
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
using System;
using Microsoft.Extensions.Primitives;


namespace Microsoft.AspNetCore.Http.Internal
{
internal struct HeaderSegment : IEquatable<HeaderSegment>
Expand All @@ -13,7 +12,7 @@ internal struct HeaderSegment : IEquatable<HeaderSegment>
private readonly StringSegment _data;

// <summary>
// Initializes a new instance of the <see cref="T:System.Object"/> class.
// Initializes a new instance of the <see cref="HeaderSegment/> structure.
// </summary>
public HeaderSegment(StringSegment formatting, StringSegment data)
{
Expand Down
32 changes: 16 additions & 16 deletions src/Microsoft.AspNetCore.Http.Features/IFormCollection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,35 +12,35 @@ namespace Microsoft.AspNetCore.Http
public interface IFormCollection : IEnumerable<KeyValuePair<string, StringValues>>
{
/// <summary>
/// Gets the number of elements contained in the <see cref="T:Microsoft.AspNetCore.Http.IFormCollection" />.
/// Gets the number of elements contained in the <see cref="IFormCollection" />.
/// </summary>
/// <returns>
/// The number of elements contained in the <see cref="T:Microsoft.AspNetCore.Http.IFormCollection" />.
/// The number of elements contained in the <see cref="IFormCollection" />.
/// </returns>
int Count { get; }

/// <summary>
/// Gets an <see cref="T:System.Collections.Generic.ICollection`1" /> containing the keys of the
/// <see cref="T:Microsoft.AspNetCore.Http.IFormCollection" />.
/// Gets an <see cref="ICollection{T}" /> containing the keys of the
/// <see cref="IFormCollection" />.
/// </summary>
/// <returns>
/// An <see cref="T:System.Collections.Generic.ICollection`1" /> containing the keys of the object
/// that implements <see cref="T:Microsoft.AspNetCore.Http.IFormCollection" />.
/// An <see cref="ICollection{T}" /> containing the keys of the object
/// that implements <see cref="IFormCollection" />.
/// </returns>
ICollection<string> Keys { get; }

/// <summary>
/// Determines whether the <see cref="T:Microsoft.AspNetCore.Http.IFormCollection" /> contains an element
/// Determines whether the <see cref="IFormCollection" /> contains an element
/// with the specified key.
/// </summary>
/// <param name="key">
/// The key to locate in the <see cref="T:Microsoft.AspNetCore.Http.IFormCollection" />.
/// The key to locate in the <see cref="IFormCollection" />.
/// </param>
/// <returns>
/// true if the <see cref="T:Microsoft.AspNetCore.Http.IFormCollection" /> contains an element with
/// true if the <see cref="IFormCollection" /> contains an element with
/// the key; otherwise, false.
/// </returns>
/// <exception cref="T:System.ArgumentNullException">
/// <exception cref="System.ArgumentNullException">
/// key is null.
/// </exception>
bool ContainsKey(string key);
Expand All @@ -58,10 +58,10 @@ public interface IFormCollection : IEnumerable<KeyValuePair<string, StringValues
/// This parameter is passed uninitialized.
/// </param>
/// <returns>
/// true if the object that implements <see cref="T:Microsoft.AspNetCore.Http.IFormCollection" /> contains
/// true if the object that implements <see cref="IFormCollection" /> contains
/// an element with the specified key; otherwise, false.
/// </returns>
/// <exception cref="T:System.ArgumentNullException">
/// <exception cref="System.ArgumentNullException">
/// key is null.
/// </exception>
bool TryGetValue(string key, out StringValues value);
Expand All @@ -73,14 +73,14 @@ public interface IFormCollection : IEnumerable<KeyValuePair<string, StringValues
/// The key of the value to get.
/// </param>
/// <returns>
/// The element with the specified key, or <see cref="T:Microsoft.Extensions.Primitives.StringValues" />.Empty if the key is not present.
/// The element with the specified key, or <c>StringValues.Empty</c> if the key is not present.
/// </returns>
/// <exception cref="T:System.ArgumentNullException">
/// <exception cref="System.ArgumentNullException">
/// key is null.
/// </exception>
/// <remarks>
/// <see cref="T:Microsoft.AspNetCore.Http.IFormCollection" /> has a different indexer contract than
/// <see cref="T:System.Collections.Generic.IDictionary`2" />, as it will return StringValues.Empty for missing entries
/// <see cref="IFormCollection" /> has a different indexer contract than
/// <see cref="IDictionary{TKey, TValue}" />, as it will return <c>StringValues.Empty</c> for missing entries
/// rather than throwing an Exception.
/// </remarks>
StringValues this[string key] { get; }
Expand Down
33 changes: 16 additions & 17 deletions src/Microsoft.AspNetCore.Http.Features/IQueryCollection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,35 +12,35 @@ namespace Microsoft.AspNetCore.Http
public interface IQueryCollection : IEnumerable<KeyValuePair<string, StringValues>>
{
/// <summary>
/// Gets the number of elements contained in the <see cref="T:Microsoft.AspNetCore.Http.IQueryCollection" />.
/// Gets the number of elements contained in the <see cref="IQueryCollection" />.
/// </summary>
/// <returns>
/// The number of elements contained in the <see cref="T:Microsoft.AspNetCore.Http.IQueryCollection" />.
/// The number of elements contained in the <see cref="IQueryCollection" />.
/// </returns>
int Count { get; }

/// <summary>
/// Gets an <see cref="T:System.Collections.Generic.ICollection`1" /> containing the keys of the
/// <see cref="T:Microsoft.AspNetCore.Http.IQueryCollection" />.
/// Gets an <see cref="ICollection{T}" /> containing the keys of the
/// <see cref="IQueryCollection" />.
/// </summary>
/// <returns>
/// An <see cref="T:System.Collections.Generic.ICollection`1" /> containing the keys of the object
/// that implements <see cref="T:Microsoft.AspNetCore.Http.IQueryCollection" />.
/// An <see cref="ICollection{T}" /> containing the keys of the object
/// that implements <see cref="IQueryCollection" />.
/// </returns>
ICollection<string> Keys { get; }

/// <summary>
/// Determines whether the <see cref="T:Microsoft.AspNetCore.Http.IQueryCollection" /> contains an element
/// Determines whether the <see cref="IQueryCollection" /> contains an element
/// with the specified key.
/// </summary>
/// <param name="key">
/// The key to locate in the <see cref="T:Microsoft.AspNetCore.Http.IQueryCollection" />.
/// The key to locate in the <see cref="IQueryCollection" />.
/// </param>
/// <returns>
/// true if the <see cref="T:Microsoft.AspNetCore.Http.IQueryCollection" /> contains an element with
/// true if the <see cref="IQueryCollection" /> contains an element with
/// the key; otherwise, false.
/// </returns>
/// <exception cref="T:System.ArgumentNullException">
/// <exception cref="System.ArgumentNullException">
/// key is null.
/// </exception>
bool ContainsKey(string key);
Expand All @@ -58,10 +58,10 @@ public interface IQueryCollection : IEnumerable<KeyValuePair<string, StringValue
/// This parameter is passed uninitialized.
/// </param>
/// <returns>
/// true if the object that implements <see cref="T:Microsoft.AspNetCore.Http.IQueryCollection" /> contains
/// true if the object that implements <see cref="IQueryCollection" /> contains
/// an element with the specified key; otherwise, false.
/// </returns>
/// <exception cref="T:System.ArgumentNullException">
/// <exception cref="System.ArgumentNullException">
/// key is null.
/// </exception>
bool TryGetValue(string key, out StringValues value);
Expand All @@ -73,15 +73,14 @@ public interface IQueryCollection : IEnumerable<KeyValuePair<string, StringValue
/// The key of the value to get.
/// </param>
/// <returns>
/// The element with the specified key, or <see cref="T:Microsoft.Extensions.Primitives.StringValues" />.
/// Empty if the key is not present.
/// The element with the specified key, or <c>StringValues.Empty</c> if the key is not present.
/// </returns>
/// <exception cref="T:System.ArgumentNullException">
/// <exception cref="System.ArgumentNullException">
/// key is null.
/// </exception>
/// <remarks>
/// <see cref="T:Microsoft.AspNetCore.Http.IQueryCollection" /> has a different indexer contract than
/// <see cref="T:System.Collections.Generic.IDictionary`2" />, as it will return StringValues.Empty for missing entries
/// <see cref="IQueryCollection" /> has a different indexer contract than
/// <see cref="IDictionary{TKey, TValue}" />, as it will return <c>StringValues.Empty</c> for missing entries
/// rather than throwing an Exception.
/// </remarks>
StringValues this[string key] { get; }
Expand Down
32 changes: 16 additions & 16 deletions src/Microsoft.AspNetCore.Http.Features/IRequestCookieCollection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,35 +11,35 @@ namespace Microsoft.AspNetCore.Http
public interface IRequestCookieCollection : IEnumerable<KeyValuePair<string, string>>
{
/// <summary>
/// Gets the number of elements contained in the <see cref="T:Microsoft.AspNetCore.Http.IRequestCookieCollection" />.
/// Gets the number of elements contained in the <see cref="IRequestCookieCollection" />.
/// </summary>
/// <returns>
/// The number of elements contained in the <see cref="T:Microsoft.AspNetCore.Http.IRequestCookieCollection" />.
/// The number of elements contained in the <see cref="IRequestCookieCollection" />.
/// </returns>
int Count { get; }

/// <summary>
/// Gets an <see cref="T:System.Collections.Generic.ICollection`1" /> containing the keys of the
/// <see cref="T:Microsoft.AspNetCore.Http.IRequestCookieCollection" />.
/// Gets an <see cref="ICollection{T}" /> containing the keys of the
/// <see cref="IRequestCookieCollection" />.
/// </summary>
/// <returns>
/// An <see cref="T:System.Collections.Generic.ICollection`1" /> containing the keys of the object
/// that implements <see cref="T:Microsoft.AspNetCore.Http.IRequestCookieCollection" />.
/// An <see cref="ICollection{T}" /> containing the keys of the object
/// that implements <see cref="IRequestCookieCollection" />.
/// </returns>
ICollection<string> Keys { get; }

/// <summary>
/// Determines whether the <see cref="T:Microsoft.AspNetCore.Http.IRequestCookieCollection" /> contains an element
/// Determines whether the <see cref="IRequestCookieCollection" /> contains an element
/// with the specified key.
/// </summary>
/// <param name="key">
/// The key to locate in the <see cref="T:Microsoft.AspNetCore.Http.IRequestCookieCollection" />.
/// The key to locate in the <see cref="IRequestCookieCollection" />.
/// </param>
/// <returns>
/// true if the <see cref="T:Microsoft.AspNetCore.Http.IRequestCookieCollection" /> contains an element with
/// true if the <see cref="IRequestCookieCollection" /> contains an element with
/// the key; otherwise, false.
/// </returns>
/// <exception cref="T:System.ArgumentNullException">
/// <exception cref="System.ArgumentNullException">
/// key is null.
/// </exception>
bool ContainsKey(string key);
Expand All @@ -57,10 +57,10 @@ public interface IRequestCookieCollection : IEnumerable<KeyValuePair<string, str
/// This parameter is passed uninitialized.
/// </param>
/// <returns>
/// true if the object that implements <see cref="T:Microsoft.AspNetCore.Http.IRequestCookieCollection" /> contains
/// true if the object that implements <see cref="IRequestCookieCollection" /> contains
/// an element with the specified key; otherwise, false.
/// </returns>
/// <exception cref="T:System.ArgumentNullException">
/// <exception cref="System.ArgumentNullException">
/// key is null.
/// </exception>
bool TryGetValue(string key, out string value);
Expand All @@ -72,14 +72,14 @@ public interface IRequestCookieCollection : IEnumerable<KeyValuePair<string, str
/// The key of the value to get.
/// </param>
/// <returns>
/// The element with the specified key, or <see cref="T:System.String" />.Empty if the key is not present.
/// The element with the specified key, or <c>string.Empty</c> if the key is not present.
/// </returns>
/// <exception cref="T:System.ArgumentNullException">
/// <exception cref="System.ArgumentNullException">
/// key is null.
/// </exception>
/// <remarks>
/// <see cref="T:Microsoft.AspNetCore.Http.IRequestCookieCollection" /> has a different indexer contract than
/// <see cref="T:System.Collections.Generic.IDictionary`2" />, as it will return String.Empty for missing entries
/// <see cref="IRequestCookieCollection" /> has a different indexer contract than
/// <see cref="IDictionary{TKey, TValue}" />, as it will return <c>string.Empty</c> for missing entries
/// rather than throwing an Exception.
/// </remarks>
string this[string key] { get; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
using System.Threading.Tasks;
using Microsoft.AspNetCore.Http.Features;
using Microsoft.AspNetCore.Http.Features.Authentication;
using Microsoft.AspNetCore.Http.Features.Authentication.Internal;

namespace Microsoft.AspNetCore.Http.Authentication.Internal
{
Expand Down
9 changes: 4 additions & 5 deletions src/Microsoft.AspNetCore.Http/DefaultHttpContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,9 @@
using Microsoft.AspNetCore.Http.Authentication.Internal;
using Microsoft.AspNetCore.Http.Features;
using Microsoft.AspNetCore.Http.Features.Authentication;
using Microsoft.AspNetCore.Http.Features.Authentication.Internal;
using Microsoft.AspNetCore.Http.Features.Internal;
using Microsoft.AspNetCore.Http.Internal;

namespace Microsoft.AspNetCore.Http.Internal
namespace Microsoft.AspNetCore.Http
{
public class DefaultHttpContext : HttpContext
{
Expand Down Expand Up @@ -72,7 +71,7 @@ public virtual void Uninitialize()
_websockets = null;
}
}

private IItemsFeature ItemsFeature =>
_features.Fetch(ref _features.Cache.Items, f => new ItemsFeature());

Expand Down Expand Up @@ -165,7 +164,7 @@ public override ISession Session
}
}



public override void Abort()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,10 @@

using System.Security.Claims;

namespace Microsoft.AspNetCore.Http.Features.Authentication.Internal
namespace Microsoft.AspNetCore.Http.Features.Authentication
{
public class HttpAuthenticationFeature : IHttpAuthenticationFeature
{
public HttpAuthenticationFeature()
{
}

public ClaimsPrincipal User
{
get;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.

namespace Microsoft.AspNetCore.Http.Features.Internal
namespace Microsoft.AspNetCore.Http.Features
{
/// <summary>
/// This type exists only for the purpose of unit testing where the user can directly set the
Expand Down
2 changes: 1 addition & 1 deletion src/Microsoft.AspNetCore.Http/Features/FormFeature.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
using Microsoft.AspNetCore.WebUtilities;
using Microsoft.Net.Http.Headers;

namespace Microsoft.AspNetCore.Http.Features.Internal
namespace Microsoft.AspNetCore.Http.Features
{
public class FormFeature : IFormFeature
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,10 @@

using System.Net;

namespace Microsoft.AspNetCore.Http.Features.Internal
namespace Microsoft.AspNetCore.Http.Features
{
public class HttpConnectionFeature : IHttpConnectionFeature
{
public HttpConnectionFeature()
{
}

public string ConnectionId { get; set; }

public IPAddress LocalIpAddress { get; set; }
Expand Down
3 changes: 1 addition & 2 deletions src/Microsoft.AspNetCore.Http/Features/HttpRequestFeature.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.

using System.IO;
using Microsoft.AspNetCore.Http.Internal;

namespace Microsoft.AspNetCore.Http.Features.Internal
namespace Microsoft.AspNetCore.Http.Features
{
public class HttpRequestFeature : IHttpRequestFeature
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
using System;
using System.Threading;

namespace Microsoft.AspNetCore.Http.Features.Internal
namespace Microsoft.AspNetCore.Http.Features
{
public class HttpRequestIdentifierFeature : IHttpRequestIdentifierFeature
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

using System.Threading;

namespace Microsoft.AspNetCore.Http.Features.Internal
namespace Microsoft.AspNetCore.Http.Features
{
public class HttpRequestLifetimeFeature : IHttpRequestLifetimeFeature
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,8 @@
using System;
using System.IO;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Http.Internal;

namespace Microsoft.AspNetCore.Http.Features.Internal
namespace Microsoft.AspNetCore.Http.Features
{
public class HttpResponseFeature : IHttpResponseFeature
{
Expand Down
Loading

0 comments on commit 6725d68

Please sign in to comment.