diff --git a/src/System.Net.Http.Formatting/Formatting/Parsers/InternetMessageFormatHeaderParser.cs b/src/System.Net.Http.Formatting/Formatting/Parsers/InternetMessageFormatHeaderParser.cs index aebfa8c29..ebf22b9ba 100644 --- a/src/System.Net.Http.Formatting/Formatting/Parsers/InternetMessageFormatHeaderParser.cs +++ b/src/System.Net.Http.Formatting/Formatting/Parsers/InternetMessageFormatHeaderParser.cs @@ -10,8 +10,8 @@ namespace System.Net.Http.Formatting.Parsers { /// - /// Buffer-oriented RFC 5322 style Internet Message Format parser which can be used to pass header - /// fields used in HTTP and MIME message entities. + /// Buffer-oriented RFC 5322 style Internet Message Format parser which can be used to pass header + /// fields used in HTTP and MIME message entities. /// internal class InternetMessageFormatHeaderParser { @@ -76,7 +76,7 @@ private enum HeaderFieldState /// /// Parse a buffer of RFC 5322 style header fields and add them to the collection. - /// Bytes are parsed in a consuming manner from the beginning of the buffer meaning that the same bytes can not be + /// Bytes are parsed in a consuming manner from the beginning of the buffer meaning that the same bytes can not be /// present in the buffer. /// /// Request buffer from where request is read @@ -283,7 +283,7 @@ private static ParserState ParseHeaderFields( } /// - /// Maintains information about the current header field being parsed. + /// Maintains information about the current header field being parsed. /// private class CurrentHeaderFieldStore { @@ -320,6 +320,10 @@ public void CopyTo(HttpHeaders headers, bool ignoreHeaderValidation) { var name = _name.ToString(); var value = _value.ToString().Trim(CurrentHeaderFieldStore._linearWhiteSpace); + if (string.Equals("expires", name, StringComparison.OrdinalIgnoreCase)) + { + ignoreHeaderValidation = true; + } if (ignoreHeaderValidation) { diff --git a/src/WebApiHelpPage/VB/WebApiHelpPageVB.vbproj b/src/WebApiHelpPage/VB/WebApiHelpPageVB.vbproj index 5c1d45882..116d126b7 100644 --- a/src/WebApiHelpPage/VB/WebApiHelpPageVB.vbproj +++ b/src/WebApiHelpPage/VB/WebApiHelpPageVB.vbproj @@ -11,6 +11,8 @@ $(CodeAnalysis) ..\..\Strict.ruleset Windows + + $(NoWarn);NU5125 true diff --git a/src/WebApiHelpPage/WebApiHelpPage.csproj b/src/WebApiHelpPage/WebApiHelpPage.csproj index 15964d7c8..38c333f6b 100644 --- a/src/WebApiHelpPage/WebApiHelpPage.csproj +++ b/src/WebApiHelpPage/WebApiHelpPage.csproj @@ -13,6 +13,8 @@ ..\Strict.ruleset $(DefineConstants);ASPNETMVC 1591 + + $(NoWarn);NU5125 diff --git a/test/Microsoft.TestCommon/PlatformInfo.cs b/test/Microsoft.TestCommon/PlatformInfo.cs index 678ecff08..e3026e39e 100644 --- a/test/Microsoft.TestCommon/PlatformInfo.cs +++ b/test/Microsoft.TestCommon/PlatformInfo.cs @@ -26,7 +26,7 @@ private static Platform GetPlatform() { if (Type.GetType(_netCore20TypeName, throwOnError: false) != null) { - // Treat .NET Core 2.0 as a .NET 4.5 superset though internal types are different. + // Treat .NET Core 2.1 as a .NET 4.5 superset though internal types are different. return Platform.Net45; } diff --git a/test/System.Net.Http.Formatting.NetStandard.Test/System.Net.Http.Formatting.NetStandard.Test.csproj b/test/System.Net.Http.Formatting.NetStandard.Test/System.Net.Http.Formatting.NetStandard.Test.csproj index 31732bd10..6cfb16e25 100644 --- a/test/System.Net.Http.Formatting.NetStandard.Test/System.Net.Http.Formatting.NetStandard.Test.csproj +++ b/test/System.Net.Http.Formatting.NetStandard.Test/System.Net.Http.Formatting.NetStandard.Test.csproj @@ -1,7 +1,7 @@  - netcoreapp2.0;net461 + netcoreapp2.1;net461 System.Net.Http System.Net.Http.Formatting.NetStandard.Test ..\..\bin\$(Configuration)\Test\ diff --git a/test/System.Net.Http.Formatting.Test/DataSets/HttpTestData.cs b/test/System.Net.Http.Formatting.Test/DataSets/HttpTestData.cs index fb482788b..84178a3a6 100644 --- a/test/System.Net.Http.Formatting.Test/DataSets/HttpTestData.cs +++ b/test/System.Net.Http.Formatting.Test/DataSets/HttpTestData.cs @@ -302,11 +302,11 @@ public static TheoryDataSet ReadAndWriteCorrectCharacterEn { "This is a test 激光這兩個字是甚麼意思 string written using utf-8", "utf-8", true }, { "This is a test 激光這兩個字是甚麼意思 string written using utf-16", "utf-16", true }, { "This is a test 激光這兩個字是甚麼意思 string written using utf-32", "utf-32", false }, -#if !NETCOREAPP2_0 // shift_jis and iso-2022-kr are not supported when running on .NET Core 2.0. +#if !NETCOREAPP // shift_jis and iso-2022-kr are not supported when running on .NET Core 2.1. { "This is a test 激光這兩個字是甚麼意思 string written using shift_jis", "shift_jis", false }, #endif { "This is a test æøå string written using iso-8859-1", "iso-8859-1", false }, -#if !NETCOREAPP2_0 +#if !NETCOREAPP { "This is a test 레이저 단어 뜻 string written using iso-2022-kr", "iso-2022-kr", false }, #endif }; diff --git a/test/System.Net.Http.Formatting.Test/Formatting/BsonMediaTypeFormatterTests.cs b/test/System.Net.Http.Formatting.Test/Formatting/BsonMediaTypeFormatterTests.cs index d849df473..caf93e059 100644 --- a/test/System.Net.Http.Formatting.Test/Formatting/BsonMediaTypeFormatterTests.cs +++ b/test/System.Net.Http.Formatting.Test/Formatting/BsonMediaTypeFormatterTests.cs @@ -415,7 +415,7 @@ public async Task ReadFromStreamAsync_RoundTripsWriteToStreamAsync_DBNullAsNull( Assert.Null(readObj); } -#if !NETCOREAPP2_0 // DBNull not serializable on .NET Core 2.0 except at top level (using BsonMediaTypeformatter special case). +#if !NETCOREAPP // DBNull not serializable on .NET Core 2.1 except at top level (using BsonMediaTypeformatter special case). [Theory] [TestDataSet(typeof(JsonMediaTypeFormatterTests), "DBNullAsObjectTestDataCollection", TestDataVariations.AsDictionary)] public async Task ReadFromStreamAsync_RoundTripsWriteToStreamAsync_DBNullAsNull_Dictionary(Type variationType, object testData) diff --git a/test/System.Net.Http.Formatting.Test/Formatting/DataContractJsonMediaTypeFormatterTests.cs b/test/System.Net.Http.Formatting.Test/Formatting/DataContractJsonMediaTypeFormatterTests.cs index ad3311326..e576a6924 100644 --- a/test/System.Net.Http.Formatting.Test/Formatting/DataContractJsonMediaTypeFormatterTests.cs +++ b/test/System.Net.Http.Formatting.Test/Formatting/DataContractJsonMediaTypeFormatterTests.cs @@ -157,7 +157,7 @@ public async Task ReadFromStreamAsync_RoundTripsWriteToStreamAsync_KnownTypes(Ty } } -#if !NETCOREAPP2_0 // DBNull not serializable on .NET Core 2.0. +#if !NETCOREAPP // DBNull not serializable on .NET Core 2.1. // Test alternate null value [Fact] public async Task ReadFromStreamAsync_RoundTripsWriteToStreamAsync_DBNull() diff --git a/test/System.Net.Http.Formatting.Test/Formatting/JsonMediaTypeFormatterTests.cs b/test/System.Net.Http.Formatting.Test/Formatting/JsonMediaTypeFormatterTests.cs index 34d17d884..3d7898ddb 100644 --- a/test/System.Net.Http.Formatting.Test/Formatting/JsonMediaTypeFormatterTests.cs +++ b/test/System.Net.Http.Formatting.Test/Formatting/JsonMediaTypeFormatterTests.cs @@ -374,7 +374,7 @@ public async Task ReadFromStreamAsync_RoundTripsWriteToStreamAsync(Type variatio } } -#if !NETCOREAPP2_0 // DBNull not serializable on .NET Core 2.0. +#if !NETCOREAPP // DBNull not serializable on .NET Core 2.1. // Test alternate null value; always serialized as "null" [Theory] [TestDataSet(typeof(JsonMediaTypeFormatterTests), "DBNullAsObjectTestDataCollection", TestDataVariations.AllSingleInstances)] diff --git a/test/System.Net.Http.Formatting.Test/Formatting/JsonNetSerializationTest.cs b/test/System.Net.Http.Formatting.Test/Formatting/JsonNetSerializationTest.cs index b544752f0..bd0edfd20 100644 --- a/test/System.Net.Http.Formatting.Test/Formatting/JsonNetSerializationTest.cs +++ b/test/System.Net.Http.Formatting.Test/Formatting/JsonNetSerializationTest.cs @@ -258,7 +258,7 @@ public Task DeserializingDeepArraysThrows() // low surrogate not preceded by high surrogate [InlineData("ABC \\udc00\\ud800 DEF", "ABC \ufffd\ufffd DEF")] // make sure unencoded invalid surrogate characters don't make it through -#if NETCOREAPP2_0 // Json.NET uses its regular invalid Unicode character on .NET Core 2.0; '?' elsewhere. +#if NETCOREAPP // Json.NET uses its regular invalid Unicode character on .NET Core 2.1; '?' elsewhere. [InlineData("\udc00\ud800\ud800", "\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd")] #else [InlineData("\udc00\ud800\ud800", "??????")] diff --git a/test/System.Net.Http.Formatting.Test/Formatting/XmlMediaTypeFormatterTests.cs b/test/System.Net.Http.Formatting.Test/Formatting/XmlMediaTypeFormatterTests.cs index b1865376b..3d7fd1557 100644 --- a/test/System.Net.Http.Formatting.Test/Formatting/XmlMediaTypeFormatterTests.cs +++ b/test/System.Net.Http.Formatting.Test/Formatting/XmlMediaTypeFormatterTests.cs @@ -36,7 +36,7 @@ public class XmlMediaTypeFormatterTests : MediaTypeFormatterTestBase NotSupportedFilePaths { get @@ -44,6 +45,7 @@ public static TheoryDataSet NotSupportedFilePaths }; } } +#endif public static TheoryDataSet InvalidFilePaths { @@ -52,15 +54,17 @@ public static TheoryDataSet InvalidFilePaths return new TheoryDataSet { "", - " ", + " ", " ", - "\t\t \n ", +#if !NETCOREAPP // .NET Core does not enforce path validity in many APIs. + "\t\t \n ", "c:\\ab", "c:\\a\"b", "c:\\a\tb", "c:\\a|b", "c:\\a\bb", +#endif "c:\\a\0b", "c :\\a\0b", }; @@ -73,12 +77,14 @@ public void Constructor_ThrowsOnNullRootPath() Assert.ThrowsArgumentNull(() => { new MultipartFileStreamProvider(null); }, "rootPath"); } +#if !NETCOREAPP // .NET Core does not enforce path validity in many APIs. [Theory] [PropertyData("NotSupportedFilePaths")] public void Constructor_ThrowsOnNotSupportedRootPath(string notSupportedPath) { Assert.Throws(() => new MultipartFileStreamProvider(notSupportedPath, ValidBufferSize)); } +#endif [Theory] [PropertyData("InvalidFilePaths")]