From 6ad9f3e8b0cdb3526b15f317ac8e2c608642ef5d Mon Sep 17 00:00:00 2001 From: John Luo Date: Tue, 28 Feb 2017 13:55:16 -0800 Subject: [PATCH] Reacting to HeaderUtitilities renames --- .../Internal/Http/FrameHeaders.Generated.cs | 16 ++++++++-------- .../Internal/Http/FrameRequestHeaders.cs | 2 +- .../Internal/Http/FrameResponseHeaders.cs | 2 +- .../FrameHeadersTests.cs | 2 +- tools/CodeGenerator/KnownHeaders.cs | 8 ++++---- 5 files changed, 15 insertions(+), 15 deletions(-) diff --git a/src/Microsoft.AspNetCore.Server.Kestrel/Internal/Http/FrameHeaders.Generated.cs b/src/Microsoft.AspNetCore.Server.Kestrel/Internal/Http/FrameHeaders.Generated.cs index 051b6b5737..df02ae9a33 100644 --- a/src/Microsoft.AspNetCore.Server.Kestrel/Internal/Http/FrameHeaders.Generated.cs +++ b/src/Microsoft.AspNetCore.Server.Kestrel/Internal/Http/FrameHeaders.Generated.cs @@ -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("Content-Length", HeaderUtilities.FormatInt64(_contentLength.Value)); + array[arrayIndex] = new KeyValuePair("Content-Length", HeaderUtilities.FormatNonNegativeInt64(_contentLength.Value)); ++arrayIndex; } ((ICollection>)MaybeUnknown)?.CopyTo(array, arrayIndex); @@ -4767,7 +4767,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Internal.Http state44: if (_collection._contentLength.HasValue) { - _current = new KeyValuePair("Content-Length", HeaderUtilities.FormatInt64(_collection._contentLength.Value)); + _current = new KeyValuePair("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("Content-Length", HeaderUtilities.FormatInt64(_contentLength.Value)); + array[arrayIndex] = new KeyValuePair("Content-Length", HeaderUtilities.FormatNonNegativeInt64(_contentLength.Value)); ++arrayIndex; } ((ICollection>)MaybeUnknown)?.CopyTo(array, arrayIndex); @@ -8970,7 +8970,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Internal.Http state36: if (_collection._contentLength.HasValue) { - _current = new KeyValuePair("Content-Length", HeaderUtilities.FormatInt64(_collection._contentLength.Value)); + _current = new KeyValuePair("Content-Length", HeaderUtilities.FormatNonNegativeInt64(_collection._contentLength.Value)); _state = 37; return true; } diff --git a/src/Microsoft.AspNetCore.Server.Kestrel/Internal/Http/FrameRequestHeaders.cs b/src/Microsoft.AspNetCore.Server.Kestrel/Internal/Http/FrameRequestHeaders.cs index ca6496d320..b7432853b7 100644 --- a/src/Microsoft.AspNetCore.Server.Kestrel/Internal/Http/FrameRequestHeaders.cs +++ b/src/Microsoft.AspNetCore.Server.Kestrel/Internal/Http/FrameRequestHeaders.cs @@ -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); } diff --git a/src/Microsoft.AspNetCore.Server.Kestrel/Internal/Http/FrameResponseHeaders.cs b/src/Microsoft.AspNetCore.Server.Kestrel/Internal/Http/FrameResponseHeaders.cs index 4666041dd9..836d73774a 100644 --- a/src/Microsoft.AspNetCore.Server.Kestrel/Internal/Http/FrameResponseHeaders.cs +++ b/src/Microsoft.AspNetCore.Server.Kestrel/Internal/Http/FrameResponseHeaders.cs @@ -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); } diff --git a/test/Microsoft.AspNetCore.Server.KestrelTests/FrameHeadersTests.cs b/test/Microsoft.AspNetCore.Server.KestrelTests/FrameHeadersTests.cs index 83856879ad..24ec00d821 100644 --- a/test/Microsoft.AspNetCore.Server.KestrelTests/FrameHeadersTests.cs +++ b/test/Microsoft.AspNetCore.Server.KestrelTests/FrameHeadersTests.cs @@ -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); diff --git a/tools/CodeGenerator/KnownHeaders.cs b/tools/CodeGenerator/KnownHeaders.cs index a211013404..ae8756af2d 100644 --- a/tools/CodeGenerator/KnownHeaders.cs +++ b/tools/CodeGenerator/KnownHeaders.cs @@ -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(""Content-Length"", HeaderUtilities.FormatInt64(_contentLength.Value)); + array[arrayIndex] = new KeyValuePair(""Content-Length"", HeaderUtilities.FormatNonNegativeInt64(_contentLength.Value)); ++arrayIndex; }} ((ICollection>)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(""Content-Length"", HeaderUtilities.FormatInt64(_collection._contentLength.Value)); + _current = new KeyValuePair(""Content-Length"", HeaderUtilities.FormatNonNegativeInt64(_collection._contentLength.Value)); _state = {loop.Headers.Count() + 1}; return true; }}