Reacting to HeaderUtitilities renames

This commit is contained in:
John Luo 2017-02-28 13:55:16 -08:00
parent 568aaff9c4
commit 6ad9f3e8b0
5 changed files with 15 additions and 15 deletions

View File

@ -754,7 +754,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Internal.Http
StringValues value;
if (_contentLength.HasValue)
{
value = new StringValues(HeaderUtilities.FormatInt64(_contentLength.Value));
value = new StringValues(HeaderUtilities.FormatNonNegativeInt64(_contentLength.Value));
}
return value;
}
@ -1120,7 +1120,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Internal.Http
{
if (_contentLength.HasValue)
{
value = HeaderUtilities.FormatInt64(_contentLength.Value);
value = HeaderUtilities.FormatNonNegativeInt64(_contentLength.Value);
return true;
}
return false;
@ -3492,7 +3492,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Internal.Http
{
return false;
}
array[arrayIndex] = new KeyValuePair<string, StringValues>("Content-Length", HeaderUtilities.FormatInt64(_contentLength.Value));
array[arrayIndex] = new KeyValuePair<string, StringValues>("Content-Length", HeaderUtilities.FormatNonNegativeInt64(_contentLength.Value));
++arrayIndex;
}
((ICollection<KeyValuePair<string, StringValues>>)MaybeUnknown)?.CopyTo(array, arrayIndex);
@ -4767,7 +4767,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Internal.Http
state44:
if (_collection._contentLength.HasValue)
{
_current = new KeyValuePair<string, StringValues>("Content-Length", HeaderUtilities.FormatInt64(_collection._contentLength.Value));
_current = new KeyValuePair<string, StringValues>("Content-Length", HeaderUtilities.FormatNonNegativeInt64(_collection._contentLength.Value));
_state = 45;
return true;
}
@ -5399,7 +5399,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Internal.Http
StringValues value;
if (_contentLength.HasValue)
{
value = new StringValues(HeaderUtilities.FormatInt64(_contentLength.Value));
value = new StringValues(HeaderUtilities.FormatNonNegativeInt64(_contentLength.Value));
}
return value;
}
@ -5835,7 +5835,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Internal.Http
{
if (_contentLength.HasValue)
{
value = HeaderUtilities.FormatInt64(_contentLength.Value);
value = HeaderUtilities.FormatNonNegativeInt64(_contentLength.Value);
return true;
}
return false;
@ -7744,7 +7744,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Internal.Http
{
return false;
}
array[arrayIndex] = new KeyValuePair<string, StringValues>("Content-Length", HeaderUtilities.FormatInt64(_contentLength.Value));
array[arrayIndex] = new KeyValuePair<string, StringValues>("Content-Length", HeaderUtilities.FormatNonNegativeInt64(_contentLength.Value));
++arrayIndex;
}
((ICollection<KeyValuePair<string, StringValues>>)MaybeUnknown)?.CopyTo(array, arrayIndex);
@ -8970,7 +8970,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Internal.Http
state36:
if (_collection._contentLength.HasValue)
{
_current = new KeyValuePair<string, StringValues>("Content-Length", HeaderUtilities.FormatInt64(_collection._contentLength.Value));
_current = new KeyValuePair<string, StringValues>("Content-Length", HeaderUtilities.FormatNonNegativeInt64(_collection._contentLength.Value));
_state = 37;
return true;
}

View File

@ -16,7 +16,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Internal.Http
private static long ParseContentLength(string value)
{
long parsed;
if (!HeaderUtilities.TryParseInt64(value, out parsed))
if (!HeaderUtilities.TryParseNonNegativeInt64(value, out parsed))
{
ThrowInvalidContentLengthException(value);
}

View File

@ -58,7 +58,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Internal.Http
private static long ParseContentLength(string value)
{
long parsed;
if (!HeaderUtilities.TryParseInt64(value, out parsed))
if (!HeaderUtilities.TryParseNonNegativeInt64(value, out parsed))
{
ThrowInvalidContentLengthException(value);
}

View File

@ -252,7 +252,7 @@ namespace Microsoft.AspNetCore.Server.KestrelTests
frameHeaders.ContentLength = long.MaxValue;
Assert.True(headers.TryGetValue("Content-Length", out value));
Assert.Equal(HeaderUtilities.FormatInt64(long.MaxValue), value[0]);
Assert.Equal(HeaderUtilities.FormatNonNegativeInt64(long.MaxValue), value[0]);
Assert.Equal(long.MaxValue, frameHeaders.ContentLength);
Assert.True(frameHeaders.ContentLength.HasValue);

View File

@ -317,7 +317,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Internal.Http
StringValues value;
if (_contentLength.HasValue)
{{
value = new StringValues(HeaderUtilities.FormatInt64(_contentLength.Value));
value = new StringValues(HeaderUtilities.FormatNonNegativeInt64(_contentLength.Value));
}}
return value;
}}
@ -363,7 +363,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Internal.Http
{{{(header.Identifier == "ContentLength" ? @"
if (_contentLength.HasValue)
{
value = HeaderUtilities.FormatInt64(_contentLength.Value);
value = HeaderUtilities.FormatNonNegativeInt64(_contentLength.Value);
return true;
}
return false;" : $@"
@ -513,7 +513,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Internal.Http
{{
return false;
}}
array[arrayIndex] = new KeyValuePair<string, StringValues>(""Content-Length"", HeaderUtilities.FormatInt64(_contentLength.Value));
array[arrayIndex] = new KeyValuePair<string, StringValues>(""Content-Length"", HeaderUtilities.FormatNonNegativeInt64(_contentLength.Value));
++arrayIndex;
}}
((ICollection<KeyValuePair<string, StringValues>>)MaybeUnknown)?.CopyTo(array, arrayIndex);
@ -614,7 +614,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Internal.Http
state{loop.Headers.Count()}:
if (_collection._contentLength.HasValue)
{{
_current = new KeyValuePair<string, StringValues>(""Content-Length"", HeaderUtilities.FormatInt64(_collection._contentLength.Value));
_current = new KeyValuePair<string, StringValues>(""Content-Length"", HeaderUtilities.FormatNonNegativeInt64(_collection._contentLength.Value));
_state = {loop.Headers.Count() + 1};
return true;
}}