Merge branch 'release/2.2'

This commit is contained in:
Chris Ross (ASP.NET) 2018-10-17 10:18:47 -07:00
commit 1e84159abb
4 changed files with 8 additions and 4 deletions

View File

@ -1,6 +1,7 @@
// Copyright (c) .NET Foundation. All rights reserved. // 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. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System.Globalization;
using System.Net; using System.Net;
namespace Microsoft.AspNetCore.HttpOverrides.Internal namespace Microsoft.AspNetCore.HttpOverrides.Internal
@ -62,7 +63,7 @@ namespace Microsoft.AspNetCore.HttpOverrides.Internal
if (portPart != null) if (portPart != null)
{ {
int port; int port;
if (int.TryParse(portPart, out port)) if (int.TryParse(portPart, NumberStyles.None, CultureInfo.InvariantCulture, out port))
{ {
endpoint = new IPEndPoint(address, port); endpoint = new IPEndPoint(address, port);
return true; return true;

View File

@ -2,6 +2,7 @@
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System; using System;
using System.Globalization;
namespace Microsoft.AspNetCore.Rewrite.Internal.ApacheModRewrite namespace Microsoft.AspNetCore.Rewrite.Internal.ApacheModRewrite
{ {
@ -216,7 +217,7 @@ namespace Microsoft.AspNetCore.Rewrite.Internal.ApacheModRewrite
{ {
// If the type is an integer, verify operand is actually an int // If the type is an integer, verify operand is actually an int
int res; int res;
if (!int.TryParse(results.Operand, out res)) if (!int.TryParse(results.Operand, NumberStyles.None, CultureInfo.InvariantCulture, out res))
{ {
return false; return false;
} }

View File

@ -3,6 +3,7 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Globalization;
using Microsoft.AspNetCore.Rewrite.Internal.PatternSegments; using Microsoft.AspNetCore.Rewrite.Internal.PatternSegments;
namespace Microsoft.AspNetCore.Rewrite.Internal.IISUrlRewrite namespace Microsoft.AspNetCore.Rewrite.Internal.IISUrlRewrite
@ -181,7 +182,7 @@ namespace Microsoft.AspNetCore.Rewrite.Internal.IISUrlRewrite
var res = context.Capture(); var res = context.Capture();
int index; int index;
if (!int.TryParse(res, out index)) if (!int.TryParse(res, NumberStyles.None, CultureInfo.InvariantCulture, out index))
{ {
throw new FormatException(Resources.FormatError_InputParserInvalidInteger(res, context.Index)); throw new FormatException(Resources.FormatError_InputParserInvalidInteger(res, context.Index));
} }

View File

@ -3,6 +3,7 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Globalization;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using System.Xml.Linq; using System.Xml.Linq;
@ -219,7 +220,7 @@ namespace Microsoft.AspNetCore.Rewrite.Internal.IISUrlRewrite
break; break;
case ActionType.CustomResponse: case ActionType.CustomResponse:
int statusCode; int statusCode;
if (!int.TryParse(urlAction.Attribute(RewriteTags.StatusCode)?.Value, out statusCode)) if (!int.TryParse(urlAction.Attribute(RewriteTags.StatusCode)?.Value, NumberStyles.None, CultureInfo.InvariantCulture, out statusCode))
{ {
throw new InvalidUrlRewriteFormatException(urlAction, "A valid status code is required"); throw new InvalidUrlRewriteFormatException(urlAction, "A valid status code is required");
} }