Formatting fixes

This commit is contained in:
Pranav K 2015-09-18 15:17:41 -07:00
parent 58974a9def
commit ceded805f3
16 changed files with 63 additions and 30 deletions

View File

@ -36,7 +36,7 @@ namespace Microsoft.AspNet.Http.Authentication
/// <summary> /// <summary>
/// Contains metadata about the authentication provider. /// Contains metadata about the authentication provider.
/// </summary> /// </summary>
public IDictionary<string, object> Items { get; private set; } public IDictionary<string, object> Items { get; }
/// <summary> /// <summary>
/// Gets or sets the name used to reference the authentication middleware instance. /// Gets or sets the name used to reference the authentication middleware instance.

View File

@ -40,7 +40,7 @@ namespace Microsoft.AspNet.Http.Authentication
/// <summary> /// <summary>
/// State values about the authentication session. /// State values about the authentication session.
/// </summary> /// </summary>
public IDictionary<string, string> Items { get; private set; } public IDictionary<string, string> Items { get; }
/// <summary> /// <summary>
/// Gets or sets whether the authentication session is persisted across multiple requests. /// Gets or sets whether the authentication session is persisted across multiple requests.

View File

@ -40,9 +40,10 @@ namespace Microsoft.AspNet.Http
/// </summary> /// </summary>
/// <param name="formFile">The <see cref="IFormFile"/>.</param> /// <param name="formFile">The <see cref="IFormFile"/>.</param>
/// <param name="filename">The name of the file to create.</param> /// <param name="filename">The name of the file to create.</param>
public async static Task SaveAsAsync(this IFormFile formFile, public async static Task SaveAsAsync(
string filename, this IFormFile formFile,
CancellationToken cancellationToken = default(CancellationToken)) string filename,
CancellationToken cancellationToken = default(CancellationToken))
{ {
if (formFile == null) if (formFile == null)
{ {

View File

@ -20,7 +20,7 @@ namespace Microsoft.AspNet.Http.Headers
Headers = headers; Headers = headers;
} }
public IHeaderDictionary Headers { get; private set; } public IHeaderDictionary Headers { get; }
public IList<MediaTypeHeaderValue> Accept public IList<MediaTypeHeaderValue> Accept
{ {

View File

@ -21,7 +21,7 @@ namespace Microsoft.AspNet.Http.Headers
Headers = headers; Headers = headers;
} }
public IHeaderDictionary Headers { get; private set; } public IHeaderDictionary Headers { get; }
public CacheControlHeaderValue CacheControl public CacheControlHeaderValue CacheControl
{ {

View File

@ -18,7 +18,8 @@ namespace Microsoft.AspNet.Http.Extensions
/// <param name="query"></param> /// <param name="query"></param>
/// <param name="fragment"></param> /// <param name="fragment"></param>
/// <returns></returns> /// <returns></returns>
public static string Encode(PathString pathBase = new PathString(), public static string Encode(
PathString pathBase = new PathString(),
PathString path = new PathString(), PathString path = new PathString(),
QueryString query = new QueryString(), QueryString query = new QueryString(),
FragmentString fragment = new FragmentString()) FragmentString fragment = new FragmentString())
@ -38,7 +39,8 @@ namespace Microsoft.AspNet.Http.Extensions
/// <param name="query"></param> /// <param name="query"></param>
/// <param name="fragment"></param> /// <param name="fragment"></param>
/// <returns></returns> /// <returns></returns>
public static string Encode(string scheme, public static string Encode(
string scheme,
HostString host, HostString host,
PathString pathBase = new PathString(), PathString pathBase = new PathString(),
PathString path = new PathString(), PathString path = new PathString(),

View File

@ -18,7 +18,7 @@ namespace Microsoft.AspNet.Http.Internal
Items = items; Items = items;
} }
public IDictionary<object, object> Items { get; private set; } public IDictionary<object, object> Items { get; }
// Replace the indexer with one that returns null for missing values // Replace the indexer with one that returns null for missing values
object IDictionary<object, object>.this[object key] object IDictionary<object, object>.this[object key]

View File

@ -390,7 +390,8 @@ namespace Microsoft.Net.Http.Headers
return input.Length - startIndex; return input.Length - startIndex;
} }
private static bool TrySetCacheControlValues(CacheControlHeaderValue cc, private static bool TrySetCacheControlValues(
CacheControlHeaderValue cc,
List<NameValueHeaderValue> nameValueList) List<NameValueHeaderValue> nameValueList)
{ {
foreach (NameValueHeaderValue nameValue in nameValueList) foreach (NameValueHeaderValue nameValue in nameValueList)
@ -477,7 +478,9 @@ namespace Microsoft.Net.Http.Headers
return true; return true;
} }
private static bool TrySetOptionalTokenList(NameValueHeaderValue nameValue, ref bool boolField, private static bool TrySetOptionalTokenList(
NameValueHeaderValue nameValue,
ref bool boolField,
ref ICollection<string> destination) ref ICollection<string> destination)
{ {
Contract.Requires(nameValue != null); Contract.Requires(nameValue != null);

View File

@ -340,8 +340,16 @@ namespace Microsoft.Net.Http.Headers
return true; return true;
} }
private static bool TryCreateContentRange(string input, string unit, int fromStartIndex, int fromLength, private static bool TryCreateContentRange(
int toStartIndex, int toLength, int lengthStartIndex, int lengthLength, out ContentRangeHeaderValue parsedValue) string input,
string unit,
int fromStartIndex,
int fromLength,
int toStartIndex,
int toLength,
int lengthStartIndex,
int lengthLength,
out ContentRangeHeaderValue parsedValue)
{ {
parsedValue = null; parsedValue = null;

View File

@ -163,7 +163,10 @@ namespace Microsoft.Net.Http.Headers
return true; return true;
} }
internal static int GetNextNonEmptyOrWhitespaceIndex(string input, int startIndex, bool skipEmptyValues, internal static int GetNextNonEmptyOrWhitespaceIndex(
string input,
int startIndex,
bool skipEmptyValues,
out bool separatorFound) out bool separatorFound)
{ {
Contract.Requires(input != null); Contract.Requires(input != null);

View File

@ -35,8 +35,8 @@ namespace Microsoft.Net.Http.Headers
internal const char CR = '\r'; internal const char CR = '\r';
internal const char LF = '\n'; internal const char LF = '\n';
internal const char SP = ' '; internal const char SP = ' ';
internal const char Tab = '\t'; internal const char Tab = '\t';
internal const int MaxInt64Digits = 19; internal const int MaxInt64Digits = 19;
internal const int MaxInt32Digits = 10; internal const int MaxInt32Digits = 10;
@ -263,8 +263,14 @@ namespace Microsoft.Net.Http.Headers
// "(((((comment)))))". If we wouldn't define a limit an attacker could send a comment with hundreds of nested // "(((((comment)))))". If we wouldn't define a limit an attacker could send a comment with hundreds of nested
// comments, resulting in a stack overflow exception. In addition having more than 1 nested comment (if any) // comments, resulting in a stack overflow exception. In addition having more than 1 nested comment (if any)
// is unusual. // is unusual.
private static HttpParseResult GetExpressionLength(string input, int startIndex, char openChar, private static HttpParseResult GetExpressionLength(
char closeChar, bool supportsNesting, ref int nestedCount, out int length) string input,
int startIndex,
char openChar,
char closeChar,
bool supportsNesting,
ref int nestedCount,
out int length)
{ {
Contract.Requires(input != null); Contract.Requires(input != null);
Contract.Requires((startIndex >= 0) && (startIndex < input.Length)); Contract.Requires((startIndex >= 0) && (startIndex < input.Length));

View File

@ -79,8 +79,9 @@ namespace Microsoft.Net.Http.Headers
return returnValue; return returnValue;
} }
private static int CompareBasedOnQualityFactor(MediaTypeHeaderValue mediaType1, private static int CompareBasedOnQualityFactor(
MediaTypeHeaderValue mediaType2) MediaTypeHeaderValue mediaType1,
MediaTypeHeaderValue mediaType2)
{ {
var mediaType1Quality = mediaType1.Quality ?? HeaderQuality.Match; var mediaType1Quality = mediaType1.Quality ?? HeaderQuality.Match;
var mediaType2Quality = mediaType2.Quality ?? HeaderQuality.Match; var mediaType2Quality = mediaType2.Quality ?? HeaderQuality.Match;

View File

@ -172,7 +172,10 @@ namespace Microsoft.Net.Http.Headers
return _name; return _name;
} }
internal static void ToString(ICollection<NameValueHeaderValue> values, char separator, bool leadingSeparator, internal static void ToString(
ICollection<NameValueHeaderValue> values,
char separator,
bool leadingSeparator,
StringBuilder destination) StringBuilder destination)
{ {
Contract.Assert(destination != null); Contract.Assert(destination != null);
@ -275,7 +278,10 @@ namespace Microsoft.Net.Http.Headers
// Returns the length of a name/value list, separated by 'delimiter'. E.g. "a=b, c=d, e=f" adds 3 // Returns the length of a name/value list, separated by 'delimiter'. E.g. "a=b, c=d, e=f" adds 3
// name/value pairs to 'nameValueCollection' if 'delimiter' equals ','. // name/value pairs to 'nameValueCollection' if 'delimiter' equals ','.
internal static int GetNameValueListLength(string input, int startIndex, char delimiter, internal static int GetNameValueListLength(
string input,
int startIndex,
char delimiter,
ICollection<NameValueHeaderValue> nameValueCollection) ICollection<NameValueHeaderValue> nameValueCollection)
{ {
Contract.Requires(nameValueCollection != null); Contract.Requires(nameValueCollection != null);

View File

@ -86,7 +86,9 @@ namespace Microsoft.Net.Http.Headers
// Returns the length of a range list. E.g. "1-2, 3-4, 5-6" adds 3 ranges to 'rangeCollection'. Note that empty // Returns the length of a range list. E.g. "1-2, 3-4, 5-6" adds 3 ranges to 'rangeCollection'. Note that empty
// list segments are allowed, e.g. ",1-2, , 3-4,,". // list segments are allowed, e.g. ",1-2, , 3-4,,".
internal static int GetRangeItemListLength(string input, int startIndex, internal static int GetRangeItemListLength(
string input,
int startIndex,
ICollection<RangeItemHeaderValue> rangeCollection) ICollection<RangeItemHeaderValue> rangeCollection)
{ {
Contract.Requires(rangeCollection != null); Contract.Requires(rangeCollection != null);

View File

@ -38,8 +38,9 @@ namespace Microsoft.Net.Http.Headers
/// <param name="stringWithQuality1">The first value to compare.</param> /// <param name="stringWithQuality1">The first value to compare.</param>
/// <param name="stringWithQuality2">The second value to compare</param> /// <param name="stringWithQuality2">The second value to compare</param>
/// <returns>The result of the comparison.</returns> /// <returns>The result of the comparison.</returns>
public int Compare(StringWithQualityHeaderValue stringWithQuality1, public int Compare(
StringWithQualityHeaderValue stringWithQuality2) StringWithQualityHeaderValue stringWithQuality1,
StringWithQualityHeaderValue stringWithQuality2)
{ {
if (stringWithQuality1 == null) if (stringWithQuality1 == null)
{ {

View File

@ -569,11 +569,11 @@ namespace Microsoft.Net.Http.Headers
Valid = valid; Valid = valid;
} }
public string Value { get; private set; } public string Value { get; }
public string Description { get; private set; } public string Description { get; }
public bool Valid { get; private set; } public bool Valid { get; }
} }
private void CheckValidParse(string input, ContentDispositionHeaderValue expectedResult) private void CheckValidParse(string input, ContentDispositionHeaderValue expectedResult)