diff --git a/HttpAbstractions.sln b/HttpAbstractions.sln index 7a857f0800..40feee2b00 100644 --- a/HttpAbstractions.sln +++ b/HttpAbstractions.sln @@ -1,7 +1,7 @@  Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio 14 -VisualStudioVersion = 14.0.22513.0 +VisualStudioVersion = 14.0.22609.0 MinimumVisualStudioVersion = 10.0.40219.1 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{A5A15F1C-885A-452A-A731-B0173DDBD913}" EndProject @@ -37,6 +37,8 @@ Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.Net.Http.Headers" EndProject Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.Net.Http.Headers.Tests", "test\Microsoft.Net.Http.Headers.Tests\Microsoft.Net.Http.Headers.Tests.kproj", "{E6BB7AD1-BD10-4A23-B780-F4A86ADF00D1}" EndProject +Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.Framework.WebEncoders", "src\Microsoft.Framework.WebEncoders\Microsoft.Framework.WebEncoders.kproj", "{DD2CE416-765E-4000-A03E-C2FF165DA1B6}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -201,6 +203,18 @@ Global {E6BB7AD1-BD10-4A23-B780-F4A86ADF00D1}.Release|Mixed Platforms.Build.0 = Release|Any CPU {E6BB7AD1-BD10-4A23-B780-F4A86ADF00D1}.Release|x86.ActiveCfg = Release|Any CPU {E6BB7AD1-BD10-4A23-B780-F4A86ADF00D1}.Release|x86.Build.0 = Release|Any CPU + {DD2CE416-765E-4000-A03E-C2FF165DA1B6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {DD2CE416-765E-4000-A03E-C2FF165DA1B6}.Debug|Any CPU.Build.0 = Debug|Any CPU + {DD2CE416-765E-4000-A03E-C2FF165DA1B6}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU + {DD2CE416-765E-4000-A03E-C2FF165DA1B6}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU + {DD2CE416-765E-4000-A03E-C2FF165DA1B6}.Debug|x86.ActiveCfg = Debug|Any CPU + {DD2CE416-765E-4000-A03E-C2FF165DA1B6}.Debug|x86.Build.0 = Debug|Any CPU + {DD2CE416-765E-4000-A03E-C2FF165DA1B6}.Release|Any CPU.ActiveCfg = Release|Any CPU + {DD2CE416-765E-4000-A03E-C2FF165DA1B6}.Release|Any CPU.Build.0 = Release|Any CPU + {DD2CE416-765E-4000-A03E-C2FF165DA1B6}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU + {DD2CE416-765E-4000-A03E-C2FF165DA1B6}.Release|Mixed Platforms.Build.0 = Release|Any CPU + {DD2CE416-765E-4000-A03E-C2FF165DA1B6}.Release|x86.ActiveCfg = Release|Any CPU + {DD2CE416-765E-4000-A03E-C2FF165DA1B6}.Release|x86.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -221,5 +235,6 @@ Global {93C10E50-BCBB-4D8E-9492-D46E1396225B} = {F31FF137-390C-49BF-A3BD-7C6ED3597C21} {60AA2FDB-8121-4826-8D00-9A143FEFAF66} = {A5A15F1C-885A-452A-A731-B0173DDBD913} {E6BB7AD1-BD10-4A23-B780-F4A86ADF00D1} = {F31FF137-390C-49BF-A3BD-7C6ED3597C21} + {DD2CE416-765E-4000-A03E-C2FF165DA1B6} = {A5A15F1C-885A-452A-A731-B0173DDBD913} EndGlobalSection EndGlobal diff --git a/src/Microsoft.AspNet.Http.Extensions/Encoders/EncoderExtensions.cs b/src/Microsoft.AspNet.Http.Extensions/Encoders/EncoderExtensions.cs index 65dbc541aa..6437376d08 100644 --- a/src/Microsoft.AspNet.Http.Extensions/Encoders/EncoderExtensions.cs +++ b/src/Microsoft.AspNet.Http.Extensions/Encoders/EncoderExtensions.cs @@ -5,7 +5,7 @@ using System; using Microsoft.AspNet.Http; using Microsoft.Framework.DependencyInjection; -namespace Microsoft.AspNet.WebUtilities.Encoders +namespace Microsoft.Framework.WebEncoders { /// /// Contains extension methods for fetching encoders from a service provider. diff --git a/src/Microsoft.AspNet.Http.Extensions/Encoders/EncoderOptions.cs b/src/Microsoft.AspNet.Http.Extensions/Encoders/EncoderOptions.cs index 5cc6097284..828455651a 100644 --- a/src/Microsoft.AspNet.Http.Extensions/Encoders/EncoderOptions.cs +++ b/src/Microsoft.AspNet.Http.Extensions/Encoders/EncoderOptions.cs @@ -3,7 +3,7 @@ using System; -namespace Microsoft.AspNet.WebUtilities.Encoders +namespace Microsoft.Framework.WebEncoders { /// /// Specifies options common to all three encoders (HtmlEncode, JavaScriptStringEncode, UrlEncode). @@ -14,8 +14,9 @@ namespace Microsoft.AspNet.WebUtilities.Encoders /// Specifies code point tables which do not require escaping by the encoders. /// /// - /// By default, only Basic Latin is allowed. + /// If this property is set to a null array, then by default only the 'Basic Latin' + /// code point filter is active. /// - public ICodePointFilter[] CodePointFilters { get; set; } = new[] { Microsoft.AspNet.WebUtilities.Encoders.CodePointFilters.BasicLatin }; + public ICodePointFilter[] CodePointFilters { get; set; } } } diff --git a/src/Microsoft.AspNet.Http.Extensions/Encoders/EncoderServiceCollectionExtensions.cs b/src/Microsoft.AspNet.Http.Extensions/Encoders/EncoderServiceCollectionExtensions.cs index 5e501e27a4..7cd52e384f 100644 --- a/src/Microsoft.AspNet.Http.Extensions/Encoders/EncoderServiceCollectionExtensions.cs +++ b/src/Microsoft.AspNet.Http.Extensions/Encoders/EncoderServiceCollectionExtensions.cs @@ -3,7 +3,7 @@ using System; using Microsoft.AspNet.Http; -using Microsoft.AspNet.WebUtilities.Encoders; +using Microsoft.Framework.WebEncoders; using Microsoft.Framework.ConfigurationModel; namespace Microsoft.Framework.DependencyInjection diff --git a/src/Microsoft.AspNet.Http.Extensions/Encoders/EncoderServices.cs b/src/Microsoft.AspNet.Http.Extensions/Encoders/EncoderServices.cs index d6590d8731..8bac20cae8 100644 --- a/src/Microsoft.AspNet.Http.Extensions/Encoders/EncoderServices.cs +++ b/src/Microsoft.AspNet.Http.Extensions/Encoders/EncoderServices.cs @@ -7,7 +7,7 @@ using Microsoft.Framework.ConfigurationModel; using Microsoft.Framework.DependencyInjection; using Microsoft.Framework.OptionsModel; -namespace Microsoft.AspNet.WebUtilities.Encoders +namespace Microsoft.Framework.WebEncoders { public static class EncoderServices { diff --git a/src/Microsoft.AspNet.Http.Extensions/project.json b/src/Microsoft.AspNet.Http.Extensions/project.json index a5cf55cd04..cb0f113bcd 100644 --- a/src/Microsoft.AspNet.Http.Extensions/project.json +++ b/src/Microsoft.AspNet.Http.Extensions/project.json @@ -3,7 +3,7 @@ "description": "ASP.NET 5 common extension methods for HTTP abstractions and IApplicationBuilder.", "dependencies": { "Microsoft.AspNet.Http": "1.0.0-*", - "Microsoft.AspNet.WebUtilities": "1.0.0-*", + "Microsoft.Framework.WebEncoders": "1.0.0-*", "Microsoft.Framework.DependencyInjection": "1.0.0-*", "Microsoft.Framework.OptionsModel": "1.0.0-*", "Microsoft.Net.Http.Headers": "1.0.0-*" diff --git a/src/Microsoft.AspNet.WebUtilities/project.json b/src/Microsoft.AspNet.WebUtilities/project.json index 57c6db035f..3a4c42267f 100644 --- a/src/Microsoft.AspNet.WebUtilities/project.json +++ b/src/Microsoft.AspNet.WebUtilities/project.json @@ -1,9 +1,6 @@ { "version": "1.0.0-*", - "description": "ASP.NET 5 common helper methods such as URL encoding.", - "compilationOptions": { - "allowUnsafe": true - }, + "description": "ASP.NET 5 common helper methods.", "dependencies": { }, "frameworks": { @@ -14,11 +11,8 @@ "System.Diagnostics.Debug": "4.0.10-beta-*", "System.IO": "4.0.10-beta-*", "System.IO.FileSystem": "4.0.0-beta-*", - "System.Linq": "4.0.0-beta-*", - "System.Reflection.TypeExtensions": "4.0.0-beta-*", "System.Runtime": "4.0.20-beta-*", - "System.Runtime.Extensions": "4.0.10-beta-*", - "System.Threading": "4.0.10-beta-*" + "System.Runtime.Extensions": "4.0.10-beta-*" } } } diff --git a/src/Microsoft.AspNet.WebUtilities/Encoders/CodePointFilters.cs b/src/Microsoft.Framework.WebEncoders/CodePointFilters.cs similarity index 99% rename from src/Microsoft.AspNet.WebUtilities/Encoders/CodePointFilters.cs rename to src/Microsoft.Framework.WebEncoders/CodePointFilters.cs index 9268062fd5..781636916c 100644 --- a/src/Microsoft.AspNet.WebUtilities/Encoders/CodePointFilters.cs +++ b/src/Microsoft.Framework.WebEncoders/CodePointFilters.cs @@ -4,11 +4,10 @@ using System; using System.Collections.Generic; using System.Diagnostics; -using System.Linq; using System.Runtime.CompilerServices; using System.Threading; -namespace Microsoft.AspNet.WebUtilities.Encoders +namespace Microsoft.Framework.WebEncoders { /// /// Contains predefined Unicode code point filters. @@ -2576,9 +2575,11 @@ namespace Microsoft.AspNet.WebUtilities.Encoders /// private sealed class EmptyCodePointFilter : ICodePointFilter { + private static readonly int[] _emptyArray = new int[0]; // immutable since empty + public IEnumerable GetAllowedCodePoints() { - return Enumerable.Empty(); + return _emptyArray; } } } diff --git a/src/Microsoft.AspNet.WebUtilities/Encoders/EncoderCommon.cs b/src/Microsoft.Framework.WebEncoders/EncoderCommon.cs similarity index 97% rename from src/Microsoft.AspNet.WebUtilities/Encoders/EncoderCommon.cs rename to src/Microsoft.Framework.WebEncoders/EncoderCommon.cs index a46ae99ed2..5bb405240a 100644 --- a/src/Microsoft.AspNet.WebUtilities/Encoders/EncoderCommon.cs +++ b/src/Microsoft.Framework.WebEncoders/EncoderCommon.cs @@ -3,7 +3,7 @@ using System; -namespace Microsoft.AspNet.WebUtilities.Encoders +namespace Microsoft.Framework.WebEncoders { internal static class EncoderCommon { diff --git a/src/Microsoft.AspNet.WebUtilities/Encoders/EncoderExtensions.cs b/src/Microsoft.Framework.WebEncoders/EncoderExtensions.cs similarity index 96% rename from src/Microsoft.AspNet.WebUtilities/Encoders/EncoderExtensions.cs rename to src/Microsoft.Framework.WebEncoders/EncoderExtensions.cs index 57c3b59ba7..6312387609 100644 --- a/src/Microsoft.AspNet.WebUtilities/Encoders/EncoderExtensions.cs +++ b/src/Microsoft.Framework.WebEncoders/EncoderExtensions.cs @@ -3,8 +3,9 @@ using System; using System.IO; +using Microsoft.Framework.Internal; -namespace Microsoft.AspNet.WebUtilities.Encoders +namespace Microsoft.Framework.WebEncoders { /// /// Helpful extension methods for the encoder classes. diff --git a/src/Microsoft.AspNet.WebUtilities/Encoders/HexUtil.cs b/src/Microsoft.Framework.WebEncoders/HexUtil.cs similarity index 97% rename from src/Microsoft.AspNet.WebUtilities/Encoders/HexUtil.cs rename to src/Microsoft.Framework.WebEncoders/HexUtil.cs index 05fa1c5882..e4b512d1a5 100644 --- a/src/Microsoft.AspNet.WebUtilities/Encoders/HexUtil.cs +++ b/src/Microsoft.Framework.WebEncoders/HexUtil.cs @@ -5,7 +5,7 @@ using System; using System.Diagnostics; using System.Runtime.CompilerServices; -namespace Microsoft.AspNet.WebUtilities.Encoders +namespace Microsoft.Framework.WebEncoders { /// /// Contains helpers for dealing with byte-hex char conversions. diff --git a/src/Microsoft.AspNet.WebUtilities/Encoders/HtmlEncoder.cs b/src/Microsoft.Framework.WebEncoders/HtmlEncoder.cs similarity index 99% rename from src/Microsoft.AspNet.WebUtilities/Encoders/HtmlEncoder.cs rename to src/Microsoft.Framework.WebEncoders/HtmlEncoder.cs index 14af7db2c6..7bcf12f1e3 100644 --- a/src/Microsoft.AspNet.WebUtilities/Encoders/HtmlEncoder.cs +++ b/src/Microsoft.Framework.WebEncoders/HtmlEncoder.cs @@ -6,7 +6,7 @@ using System.Diagnostics; using System.IO; using System.Threading; -namespace Microsoft.AspNet.WebUtilities.Encoders +namespace Microsoft.Framework.WebEncoders { /// /// A class which can perform HTML encoding given an allow list of characters which diff --git a/src/Microsoft.AspNet.WebUtilities/Encoders/ICodePointFilter.cs b/src/Microsoft.Framework.WebEncoders/ICodePointFilter.cs similarity index 92% rename from src/Microsoft.AspNet.WebUtilities/Encoders/ICodePointFilter.cs rename to src/Microsoft.Framework.WebEncoders/ICodePointFilter.cs index e57b6535d2..1a4fc58774 100644 --- a/src/Microsoft.AspNet.WebUtilities/Encoders/ICodePointFilter.cs +++ b/src/Microsoft.Framework.WebEncoders/ICodePointFilter.cs @@ -4,7 +4,7 @@ using System; using System.Collections.Generic; -namespace Microsoft.AspNet.WebUtilities.Encoders +namespace Microsoft.Framework.WebEncoders { /// /// Represents a filter which allows only certain Unicode code points through. diff --git a/src/Microsoft.AspNet.WebUtilities/Encoders/IHtmlEncoder.cs b/src/Microsoft.Framework.WebEncoders/IHtmlEncoder.cs similarity index 95% rename from src/Microsoft.AspNet.WebUtilities/Encoders/IHtmlEncoder.cs rename to src/Microsoft.Framework.WebEncoders/IHtmlEncoder.cs index b48aa2ddcf..0456285b23 100644 --- a/src/Microsoft.AspNet.WebUtilities/Encoders/IHtmlEncoder.cs +++ b/src/Microsoft.Framework.WebEncoders/IHtmlEncoder.cs @@ -4,8 +4,9 @@ using System; using System.IO; +using Microsoft.Framework.Internal; -namespace Microsoft.AspNet.WebUtilities.Encoders +namespace Microsoft.Framework.WebEncoders { /// /// Provides services for HTML-encoding input. diff --git a/src/Microsoft.AspNet.WebUtilities/Encoders/IJavaScriptStringEncoder.cs b/src/Microsoft.Framework.WebEncoders/IJavaScriptStringEncoder.cs similarity index 93% rename from src/Microsoft.AspNet.WebUtilities/Encoders/IJavaScriptStringEncoder.cs rename to src/Microsoft.Framework.WebEncoders/IJavaScriptStringEncoder.cs index 502c699ac4..487c1ca35c 100644 --- a/src/Microsoft.AspNet.WebUtilities/Encoders/IJavaScriptStringEncoder.cs +++ b/src/Microsoft.Framework.WebEncoders/IJavaScriptStringEncoder.cs @@ -3,8 +3,9 @@ using System; using System.IO; +using Microsoft.Framework.Internal; -namespace Microsoft.AspNet.WebUtilities.Encoders +namespace Microsoft.Framework.WebEncoders { /// /// Provides services for JavaScript-escaping strings. diff --git a/src/Microsoft.AspNet.WebUtilities/Encoders/IUrlEncoder.cs b/src/Microsoft.Framework.WebEncoders/IUrlEncoder.cs similarity index 95% rename from src/Microsoft.AspNet.WebUtilities/Encoders/IUrlEncoder.cs rename to src/Microsoft.Framework.WebEncoders/IUrlEncoder.cs index 464a92ba0e..2b4a8cbd57 100644 --- a/src/Microsoft.AspNet.WebUtilities/Encoders/IUrlEncoder.cs +++ b/src/Microsoft.Framework.WebEncoders/IUrlEncoder.cs @@ -3,8 +3,9 @@ using System; using System.IO; +using Microsoft.Framework.Internal; -namespace Microsoft.AspNet.WebUtilities.Encoders +namespace Microsoft.Framework.WebEncoders { /// /// Provides services for URL-escaping strings. diff --git a/src/Microsoft.AspNet.WebUtilities/Encoders/JavaScriptStringEncoder.cs b/src/Microsoft.Framework.WebEncoders/JavaScriptStringEncoder.cs similarity index 99% rename from src/Microsoft.AspNet.WebUtilities/Encoders/JavaScriptStringEncoder.cs rename to src/Microsoft.Framework.WebEncoders/JavaScriptStringEncoder.cs index 39d7cef34f..0d61898614 100644 --- a/src/Microsoft.AspNet.WebUtilities/Encoders/JavaScriptStringEncoder.cs +++ b/src/Microsoft.Framework.WebEncoders/JavaScriptStringEncoder.cs @@ -6,7 +6,7 @@ using System.Diagnostics; using System.IO; using System.Threading; -namespace Microsoft.AspNet.WebUtilities.Encoders +namespace Microsoft.Framework.WebEncoders { /// /// A class which can perform JavaScript string escaping given an allow list of characters which diff --git a/src/Microsoft.Framework.WebEncoders/Microsoft.Framework.WebEncoders.kproj b/src/Microsoft.Framework.WebEncoders/Microsoft.Framework.WebEncoders.kproj new file mode 100644 index 0000000000..9a3c5e9646 --- /dev/null +++ b/src/Microsoft.Framework.WebEncoders/Microsoft.Framework.WebEncoders.kproj @@ -0,0 +1,17 @@ + + + + 14.0 + $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) + + + + dd2ce416-765e-4000-a03e-c2ff165da1b6 + ..\..\artifacts\obj\$(MSBuildProjectName) + ..\..\artifacts\bin\$(MSBuildProjectName)\ + + + 2.0 + + + diff --git a/src/Microsoft.AspNet.WebUtilities/Encoders/UnicodeEncoderBase.cs b/src/Microsoft.Framework.WebEncoders/UnicodeEncoderBase.cs similarity index 99% rename from src/Microsoft.AspNet.WebUtilities/Encoders/UnicodeEncoderBase.cs rename to src/Microsoft.Framework.WebEncoders/UnicodeEncoderBase.cs index 19b5ddd90a..45ba58e02b 100644 --- a/src/Microsoft.AspNet.WebUtilities/Encoders/UnicodeEncoderBase.cs +++ b/src/Microsoft.Framework.WebEncoders/UnicodeEncoderBase.cs @@ -6,8 +6,9 @@ using System.Diagnostics; using System.IO; using System.Runtime.CompilerServices; using System.Text; +using Microsoft.Framework.Internal; -namespace Microsoft.AspNet.WebUtilities.Encoders +namespace Microsoft.Framework.WebEncoders { internal unsafe abstract class UnicodeEncoderBase { diff --git a/src/Microsoft.AspNet.WebUtilities/Encoders/UnicodeHelpers.cs b/src/Microsoft.Framework.WebEncoders/UnicodeHelpers.cs similarity index 99% rename from src/Microsoft.AspNet.WebUtilities/Encoders/UnicodeHelpers.cs rename to src/Microsoft.Framework.WebEncoders/UnicodeHelpers.cs index 89424a2612..549f912e1a 100644 --- a/src/Microsoft.AspNet.WebUtilities/Encoders/UnicodeHelpers.cs +++ b/src/Microsoft.Framework.WebEncoders/UnicodeHelpers.cs @@ -7,7 +7,7 @@ using System.Reflection; using System.Runtime.CompilerServices; using System.Threading; -namespace Microsoft.AspNet.WebUtilities.Encoders +namespace Microsoft.Framework.WebEncoders { /// /// Contains helpers for dealing with Unicode code points. diff --git a/src/Microsoft.AspNet.WebUtilities/Encoders/UrlEncoder.cs b/src/Microsoft.Framework.WebEncoders/UrlEncoder.cs similarity index 99% rename from src/Microsoft.AspNet.WebUtilities/Encoders/UrlEncoder.cs rename to src/Microsoft.Framework.WebEncoders/UrlEncoder.cs index 1a7b71799c..8df2b5bce5 100644 --- a/src/Microsoft.AspNet.WebUtilities/Encoders/UrlEncoder.cs +++ b/src/Microsoft.Framework.WebEncoders/UrlEncoder.cs @@ -6,7 +6,7 @@ using System.Diagnostics; using System.IO; using System.Threading; -namespace Microsoft.AspNet.WebUtilities.Encoders +namespace Microsoft.Framework.WebEncoders { /// /// A class which can perform URL string escaping given an allow list of characters which diff --git a/src/Microsoft.AspNet.WebUtilities/compiler/resources/unicode-7.0.0-defined-characters.bin b/src/Microsoft.Framework.WebEncoders/compiler/resources/unicode-7.0.0-defined-characters.bin similarity index 100% rename from src/Microsoft.AspNet.WebUtilities/compiler/resources/unicode-7.0.0-defined-characters.bin rename to src/Microsoft.Framework.WebEncoders/compiler/resources/unicode-7.0.0-defined-characters.bin diff --git a/src/Microsoft.Framework.WebEncoders/project.json b/src/Microsoft.Framework.WebEncoders/project.json new file mode 100644 index 0000000000..e61fe47605 --- /dev/null +++ b/src/Microsoft.Framework.WebEncoders/project.json @@ -0,0 +1,24 @@ +{ + "version": "1.0.0-*", + "description": "Contains encoders for HTML, JavaScript, and URLs.", + "compilationOptions": { + "allowUnsafe": true + }, + "dependencies": { + "Microsoft.Framework.NotNullAttribute.Internal": { "type": "build", "version": "1.0.0-*" } + }, + "frameworks": { + "net45": { }, + "aspnet50": { }, + "aspnetcore50": { + "dependencies": { + "System.Diagnostics.Debug": "4.0.10-beta-*", + "System.IO": "4.0.10-beta-*", + "System.Reflection": "4.0.10-beta-*", + "System.Runtime": "4.0.20-beta-*", + "System.Runtime.Extensions": "4.0.10-beta-*", + "System.Threading": "4.0.10-beta-*" + } + } + } +}