Code cleanup.

This commit is contained in:
Chris Ross 2014-08-21 12:13:26 -07:00
parent ddc7f08957
commit bc0732f900
5 changed files with 10 additions and 20 deletions

View File

@ -8,7 +8,7 @@ using System.Globalization;
namespace Microsoft.AspNet.Http
{
/// <summary>
/// Represents the host portion of a Uri can be used to construct Uri's properly formatted and encoded for use in
/// Represents the host portion of a URI can be used to construct URI's properly formatted and encoded for use in
/// HTTP headers.
/// </summary>
public struct HostString : IEquatable<HostString>
@ -47,7 +47,7 @@ namespace Microsoft.AspNet.Http
/// Any Unicode is converted to punycode. IPv6 addresses will have brackets added if they are missing.
/// </summary>
/// <returns></returns>
[SuppressMessage("Microsoft.Design", "CA1055:UriReturnValuesShouldNotBeStrings", Justification = "Only the host segment of a uri is returned.")]
[SuppressMessage("Microsoft.Design", "CA1055:UriReturnValuesShouldNotBeStrings", Justification = "Only the host segment of a URI is returned.")]
public string ToUriComponent()
{
int index;
@ -82,12 +82,12 @@ namespace Microsoft.AspNet.Http
}
/// <summary>
/// Creates a new HostString from the given uri component.
/// Creates a new HostString from the given URI component.
/// Any punycode will be converted to Unicode.
/// </summary>
/// <param name="uriComponent"></param>
/// <returns></returns>
[SuppressMessage("Microsoft.Design", "CA1057:StringUriOverloadsCallSystemUriOverloads", Justification = "Only the host segment of a uri is provided.")]
[SuppressMessage("Microsoft.Design", "CA1057:StringUriOverloadsCallSystemUriOverloads", Justification = "Only the host segment of a URI is provided.")]
public static HostString FromUriComponent(string uriComponent)
{
if (!string.IsNullOrEmpty(uriComponent))

View File

@ -74,7 +74,7 @@ namespace Microsoft.AspNet.Http
/// </summary>
/// <param name="uriComponent">The escaped path as it appears in the URI format.</param>
/// <returns>The resulting PathString</returns>
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1057:StringUriOverloadsCallSystemUriOverloads", Justification = "Requirements not compatible with Uri processing")]
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1057:StringUriOverloadsCallSystemUriOverloads", Justification = "Requirements not compatible with URI processing")]
public static PathString FromUriComponent(string uriComponent)
{
// REVIEW: what is the exactly correct thing to do?

View File

@ -8,7 +8,6 @@ using System.Globalization;
using System.Linq;
using Microsoft.AspNet.Http;
using Microsoft.AspNet.Http.Infrastructure;
using Microsoft.AspNet.PipelineCore.Collections;
namespace Microsoft.AspNet.PipelineCore.Infrastructure
{
@ -507,7 +506,7 @@ namespace Microsoft.AspNet.PipelineCore.Infrastructure
}
}
internal static partial class ParsingHelpers
internal static class ParsingHelpers
{
private static readonly Action<string, string, object> AddCookieCallback = (name, value, state) =>
{
@ -592,10 +591,7 @@ namespace Microsoft.AspNet.PipelineCore.Infrastructure
scanIndex = delimiterIndex + 1;
}
}
}
internal static partial class ParsingHelpers
{
public static string GetHeader(IDictionary<string, string[]> headers, string key)
{
string[] values = GetHeaderUnmodified(headers, key);
@ -783,10 +779,7 @@ namespace Microsoft.AspNet.PipelineCore.Infrastructure
SetHeaderUnmodified(headers, key, existing.Concat(values));
}
}
}
internal static partial class ParsingHelpers
{
private static readonly Action<string, string, object> AppendItemCallback = (name, value, state) =>
{
var dictionary = (IDictionary<string, List<String>>)state;
@ -833,10 +826,7 @@ namespace Microsoft.AspNet.PipelineCore.Infrastructure
string[] values;
return store.TryGetValue(key, out values) ? values : null;
}
}
internal static partial class ParsingHelpers
{
//internal static string GetHost(HttpRequest request)
//{
// IHeaderDictionary headers = request.Headers;

View File

@ -8,7 +8,7 @@ using Microsoft.AspNet.WebUtilities.Collections;
namespace Microsoft.AspNet.WebUtilities
{
internal static partial class ParsingHelpers
internal static class ParsingHelpers
{
internal static void ParseDelimited(string text, char[] delimiters, Action<string, string, object> callback, object state)
{

View File

@ -5,12 +5,12 @@ namespace Microsoft.AspNet.WebUtilities
public static class QueryHelpers
{
/// <summary>
/// Append the given query key and value to the uri.
/// Append the given query key and value to the URI.
/// </summary>
/// <param name="uri">The base uri.</param>
/// <param name="uri">The base URI.</param>
/// <param name="name">The name of the query key.</param>
/// <param name="value">The query value.</param>
/// <returns>The combine result.</returns>
/// <returns>The combined result.</returns>
public static string AddQueryString([NotNull] string uri, [NotNull] string name, [NotNull] string value)
{
bool hasQuery = uri.IndexOf('?') != -1;