diff --git a/src/Microsoft.AspNet.Http.Core/Authentication/AuthenticateContext.cs b/src/Microsoft.AspNet.Http.Core/Authentication/AuthenticateContext.cs
index 858da030a4..b623f15c50 100644
--- a/src/Microsoft.AspNet.Http.Core/Authentication/AuthenticateContext.cs
+++ b/src/Microsoft.AspNet.Http.Core/Authentication/AuthenticateContext.cs
@@ -4,7 +4,6 @@
using System.Collections.Generic;
using System.Security.Claims;
using Microsoft.AspNet.Http.Authentication;
-using Microsoft.AspNet.Http.Authentication;
namespace Microsoft.AspNet.Http.Core.Authentication
{
diff --git a/src/Microsoft.AspNet.Http.Core/Authentication/DescribeSchemesContext.cs b/src/Microsoft.AspNet.Http.Core/Authentication/DescribeSchemesContext.cs
index 7cb613ecb3..6da55ce724 100644
--- a/src/Microsoft.AspNet.Http.Core/Authentication/DescribeSchemesContext.cs
+++ b/src/Microsoft.AspNet.Http.Core/Authentication/DescribeSchemesContext.cs
@@ -3,7 +3,6 @@
using System.Collections.Generic;
using Microsoft.AspNet.Http.Authentication;
-using Microsoft.AspNet.Http.Authentication;
namespace Microsoft.AspNet.Http.Core.Authentication
{
diff --git a/src/Microsoft.AspNet.Http.Core/Collections/ResponseCookies.cs b/src/Microsoft.AspNet.Http.Core/Collections/ResponseCookies.cs
index 35aa02b17c..8066450f98 100644
--- a/src/Microsoft.AspNet.Http.Core/Collections/ResponseCookies.cs
+++ b/src/Microsoft.AspNet.Http.Core/Collections/ResponseCookies.cs
@@ -5,8 +5,8 @@ using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
-using Microsoft.AspNet.Http;
using Microsoft.AspNet.Http.Infrastructure;
+using Microsoft.Framework.WebEncoders;
namespace Microsoft.AspNet.Http.Core.Collections
{
@@ -33,7 +33,7 @@ namespace Microsoft.AspNet.Http.Core.Collections
///
public void Append(string key, string value)
{
- Headers.AppendValues(Constants.Headers.SetCookie, Uri.EscapeDataString(key) + "=" + Uri.EscapeDataString(value) + "; path=/");
+ Headers.AppendValues(Constants.Headers.SetCookie, UrlEncoder.Default.UrlEncode(key) + "=" + UrlEncoder.Default.UrlEncode(value) + "; path=/");
}
///
@@ -49,9 +49,9 @@ namespace Microsoft.AspNet.Http.Core.Collections
bool expiresHasValue = options.Expires.HasValue;
string setCookieValue = string.Concat(
- Uri.EscapeDataString(key),
+ UrlEncoder.Default.UrlEncode(key),
"=",
- Uri.EscapeDataString(value ?? string.Empty),
+ UrlEncoder.Default.UrlEncode(value ?? string.Empty),
!domainHasValue ? null : "; domain=",
!domainHasValue ? null : options.Domain,
!pathHasValue ? null : "; path=",
@@ -71,7 +71,7 @@ namespace Microsoft.AspNet.Http.Core.Collections
{
Func predicate = value => value.StartsWith(key + "=", StringComparison.OrdinalIgnoreCase);
- var deleteCookies = new[] { Uri.EscapeDataString(key) + "=; expires=Thu, 01-Jan-1970 00:00:00 GMT" };
+ var deleteCookies = new[] { UrlEncoder.Default.UrlEncode(key) + "=; expires=Thu, 01-Jan-1970 00:00:00 GMT" };
IList existingValues = Headers.GetValues(Constants.Headers.SetCookie);
if (existingValues == null || existingValues.Count == 0)
{
diff --git a/src/Microsoft.AspNet.Http.Core/Collections/SessionCollection.cs b/src/Microsoft.AspNet.Http.Core/Collections/SessionCollection.cs
index 0c7485096c..df58e4a63f 100644
--- a/src/Microsoft.AspNet.Http.Core/Collections/SessionCollection.cs
+++ b/src/Microsoft.AspNet.Http.Core/Collections/SessionCollection.cs
@@ -4,8 +4,6 @@
using System;
using System.Collections;
using System.Collections.Generic;
-using Microsoft.AspNet.Http;
-using Microsoft.AspNet.Http;
namespace Microsoft.AspNet.Http.Core.Collections
{
diff --git a/src/Microsoft.AspNet.Http.Core/QueryFeature.cs b/src/Microsoft.AspNet.Http.Core/QueryFeature.cs
index 484f41b1a9..16923fe544 100644
--- a/src/Microsoft.AspNet.Http.Core/QueryFeature.cs
+++ b/src/Microsoft.AspNet.Http.Core/QueryFeature.cs
@@ -3,8 +3,6 @@
using System.Collections.Generic;
using Microsoft.AspNet.FeatureModel;
-using Microsoft.AspNet.Http;
-using Microsoft.AspNet.Http;
using Microsoft.AspNet.Http.Core.Collections;
using Microsoft.AspNet.Http.Core.Infrastructure;
using Microsoft.AspNet.WebUtilities;
diff --git a/src/Microsoft.AspNet.Http.Core/RequestCookiesFeature.cs b/src/Microsoft.AspNet.Http.Core/RequestCookiesFeature.cs
index 6286bdd1da..192c5f866f 100644
--- a/src/Microsoft.AspNet.Http.Core/RequestCookiesFeature.cs
+++ b/src/Microsoft.AspNet.Http.Core/RequestCookiesFeature.cs
@@ -4,11 +4,9 @@
using System;
using System.Collections.Generic;
using Microsoft.AspNet.FeatureModel;
-using Microsoft.AspNet.Http;
-using Microsoft.AspNet.Http.Infrastructure;
-using Microsoft.AspNet.Http;
using Microsoft.AspNet.Http.Core.Collections;
using Microsoft.AspNet.Http.Core.Infrastructure;
+using Microsoft.AspNet.Http.Infrastructure;
namespace Microsoft.AspNet.Http.Core
{
diff --git a/src/Microsoft.AspNet.Http.Core/ResponseCookiesFeature.cs b/src/Microsoft.AspNet.Http.Core/ResponseCookiesFeature.cs
index b3c6354392..11e3c098fa 100644
--- a/src/Microsoft.AspNet.Http.Core/ResponseCookiesFeature.cs
+++ b/src/Microsoft.AspNet.Http.Core/ResponseCookiesFeature.cs
@@ -1,9 +1,7 @@
// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
-using Microsoft.AspNet.Http;
using Microsoft.AspNet.FeatureModel;
-using Microsoft.AspNet.Http;
using Microsoft.AspNet.Http.Core.Collections;
using Microsoft.AspNet.Http.Core.Infrastructure;
diff --git a/src/Microsoft.AspNet.Http.Core/project.json b/src/Microsoft.AspNet.Http.Core/project.json
index c611f9a806..569d667698 100644
--- a/src/Microsoft.AspNet.Http.Core/project.json
+++ b/src/Microsoft.AspNet.Http.Core/project.json
@@ -1,35 +1,34 @@
-
-{
- "version": "1.0.0-*",
- "description": "ASP.NET 5 HTTP feature implementations.",
- "dependencies": {
- "Microsoft.AspNet.FeatureModel": "1.0.0-*",
- "Microsoft.AspNet.Http": "1.0.0-*",
- "Microsoft.AspNet.Http.Interfaces": "1.0.0-*",
- "Microsoft.AspNet.WebUtilities": "1.0.0-*",
- "Microsoft.Net.Http.Headers": "1.0.0-*"
-
- },
- "frameworks": {
- "dnx451": {},
- "dnxcore50": {
- "dependencies": {
- "Microsoft.Net.WebSocketAbstractions": "1.0.0-*",
- "System.Collections": "4.0.10-beta-*",
- "System.ComponentModel": "4.0.0-beta-*",
- "System.Diagnostics.Debug": "4.0.10-beta-*",
- "System.Diagnostics.Tools": "4.0.0-beta-*",
- "System.Globalization": "4.0.10-beta-*",
- "System.IO": "4.0.10-beta-*",
- "System.Linq": "4.0.0-beta-*",
- "System.Runtime": "4.0.20-beta-*",
- "System.Runtime.Extensions": "4.0.10-beta-*",
- "System.Runtime.InteropServices": "4.0.20-beta-*",
- "System.Security.Claims": "4.0.0-beta-*",
- "System.Security.Principal" : "4.0.0-beta-*",
- "System.Text.Encoding": "4.0.10-beta-*",
- "System.Threading.Tasks": "4.0.10-beta-*"
- }
+{
+ "version": "1.0.0-*",
+ "description": "ASP.NET 5 HTTP feature implementations.",
+ "dependencies": {
+ "Microsoft.AspNet.FeatureModel": "1.0.0-*",
+ "Microsoft.AspNet.Http": "1.0.0-*",
+ "Microsoft.AspNet.Http.Interfaces": "1.0.0-*",
+ "Microsoft.AspNet.WebUtilities": "1.0.0-*",
+ "Microsoft.Framework.WebEncoders.Core": "1.0.0-*",
+ "Microsoft.Net.Http.Headers": "1.0.0-*"
+ },
+ "frameworks": {
+ "dnx451": { },
+ "dnxcore50": {
+ "dependencies": {
+ "Microsoft.Net.WebSocketAbstractions": "1.0.0-*",
+ "System.Collections": "4.0.10-beta-*",
+ "System.ComponentModel": "4.0.0-beta-*",
+ "System.Diagnostics.Debug": "4.0.10-beta-*",
+ "System.Diagnostics.Tools": "4.0.0-beta-*",
+ "System.Globalization": "4.0.10-beta-*",
+ "System.IO": "4.0.10-beta-*",
+ "System.Linq": "4.0.0-beta-*",
+ "System.Runtime": "4.0.20-beta-*",
+ "System.Runtime.Extensions": "4.0.10-beta-*",
+ "System.Runtime.InteropServices": "4.0.20-beta-*",
+ "System.Security.Claims": "4.0.0-beta-*",
+ "System.Security.Principal": "4.0.0-beta-*",
+ "System.Text.Encoding": "4.0.10-beta-*",
+ "System.Threading.Tasks": "4.0.10-beta-*"
+ }
+ }
}
- }
-}
+}
\ No newline at end of file
diff --git a/src/Microsoft.AspNet.Http.Extensions/QueryBuilder.cs b/src/Microsoft.AspNet.Http.Extensions/QueryBuilder.cs
index a4afbba272..98550eb832 100644
--- a/src/Microsoft.AspNet.Http.Extensions/QueryBuilder.cs
+++ b/src/Microsoft.AspNet.Http.Extensions/QueryBuilder.cs
@@ -1,10 +1,10 @@
// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
-using System;
using System.Collections;
using System.Collections.Generic;
using System.Text;
+using Microsoft.Framework.WebEncoders;
namespace Microsoft.AspNet.Http.Extensions
{
@@ -45,9 +45,9 @@ namespace Microsoft.AspNet.Http.Extensions
var pair = _params[i];
builder.Append(first ? "?" : "&");
first = false;
- builder.Append(Uri.EscapeDataString(pair.Key));
+ builder.Append(UrlEncoder.Default.UrlEncode(pair.Key));
builder.Append("=");
- builder.Append(Uri.EscapeDataString(pair.Value));
+ builder.Append(UrlEncoder.Default.UrlEncode(pair.Value));
}
return builder.ToString();
diff --git a/src/Microsoft.AspNet.Http.Extensions/project.json b/src/Microsoft.AspNet.Http.Extensions/project.json
index f2d71e2528..383484ef75 100644
--- a/src/Microsoft.AspNet.Http.Extensions/project.json
+++ b/src/Microsoft.AspNet.Http.Extensions/project.json
@@ -5,12 +5,13 @@
"Microsoft.AspNet.Http": "1.0.0-*",
"Microsoft.AspNet.Http.Interfaces": "1.0.0-*",
"Microsoft.Framework.DependencyInjection": "1.0.0-*",
+ "Microsoft.Framework.WebEncoders.Core": "1.0.0-*",
"Microsoft.Net.Http.Headers": "1.0.0-*"
},
- "frameworks" : {
- "dnx451" : {
+ "frameworks": {
+ "dnx451": {
},
- "dnxcore50" : {
+ "dnxcore50": {
"dependencies": {
"System.Reflection.TypeExtensions": "4.0.0-beta-*",
"System.Runtime": "4.0.20-beta-*"
diff --git a/src/Microsoft.AspNet.Http/PathString.cs b/src/Microsoft.AspNet.Http/PathString.cs
index 2963c64d8f..8a7f5d945c 100644
--- a/src/Microsoft.AspNet.Http/PathString.cs
+++ b/src/Microsoft.AspNet.Http/PathString.cs
@@ -3,6 +3,7 @@
using System;
using System.Linq;
+using Microsoft.Framework.WebEncoders;
namespace Microsoft.AspNet.Http
{
@@ -65,7 +66,7 @@ namespace Microsoft.AspNet.Http
public string ToUriComponent()
{
// TODO: Measure the cost of this escaping and consider optimizing.
- return HasValue ? String.Join("/", _value.Split('/').Select(Uri.EscapeDataString)) : String.Empty;
+ return HasValue ? string.Join("/", _value.Split('/').Select(UrlEncoder.Default.UrlEncode)) : string.Empty;
}
///
diff --git a/src/Microsoft.AspNet.Http/QueryString.cs b/src/Microsoft.AspNet.Http/QueryString.cs
index c32e3bb037..6b61d92f99 100644
--- a/src/Microsoft.AspNet.Http/QueryString.cs
+++ b/src/Microsoft.AspNet.Http/QueryString.cs
@@ -2,6 +2,7 @@
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
+using Microsoft.Framework.WebEncoders;
namespace Microsoft.AspNet.Http
{
@@ -38,7 +39,7 @@ namespace Microsoft.AspNet.Http
/// The un-encoded parameter value
public QueryString(string name, string value)
{
- _value = "?" + Uri.EscapeDataString(name) + '=' + Uri.EscapeDataString(value);
+ _value = "?" + UrlEncoder.Default.UrlEncode(name) + '=' + UrlEncoder.Default.UrlEncode(value);
}
///
diff --git a/src/Microsoft.AspNet.Http/project.json b/src/Microsoft.AspNet.Http/project.json
index a8c1d8aad3..30d577d013 100644
--- a/src/Microsoft.AspNet.Http/project.json
+++ b/src/Microsoft.AspNet.Http/project.json
@@ -1,26 +1,28 @@
-{
- "version": "1.0.0-*",
- "description": "ASP.NET 5 HTTP object model. HttpContext and family.",
- "dependencies": {},
- "frameworks": {
- "dnx451": {},
- "dnxcore50": {
- "dependencies": {
- "Microsoft.Net.WebSocketAbstractions": "1.0.0-*",
- "System.Collections": "4.0.10-beta-*",
- "System.ComponentModel": "4.0.0-beta-*",
- "System.Diagnostics.Tools": "4.0.0-beta-*",
- "System.Globalization": "4.0.10-beta-*",
- "System.Globalization.Extensions": "4.0.0-beta-*",
- "System.IO": "4.0.10-beta-*",
- "System.Linq": "4.0.0-beta-*",
- "System.Runtime": "4.0.20-beta-*",
- "System.Runtime.Extensions": "4.0.10-beta-*",
- "System.Runtime.InteropServices": "4.0.20-beta-*",
- "System.Security.Claims": "4.0.0-beta-*",
- "System.Security.Principal" : "4.0.0-beta-*",
- "System.Threading.Tasks": "4.0.10-beta-*"
- }
+{
+ "version": "1.0.0-*",
+ "description": "ASP.NET 5 HTTP object model. HttpContext and family.",
+ "dependencies": {
+ "Microsoft.Framework.WebEncoders.Core": "1.0.0-*"
+ },
+ "frameworks": {
+ "dnx451": { },
+ "dnxcore50": {
+ "dependencies": {
+ "Microsoft.Net.WebSocketAbstractions": "1.0.0-*",
+ "System.Collections": "4.0.10-beta-*",
+ "System.ComponentModel": "4.0.0-beta-*",
+ "System.Diagnostics.Tools": "4.0.0-beta-*",
+ "System.Globalization": "4.0.10-beta-*",
+ "System.Globalization.Extensions": "4.0.0-beta-*",
+ "System.IO": "4.0.10-beta-*",
+ "System.Linq": "4.0.0-beta-*",
+ "System.Runtime": "4.0.20-beta-*",
+ "System.Runtime.Extensions": "4.0.10-beta-*",
+ "System.Runtime.InteropServices": "4.0.20-beta-*",
+ "System.Security.Claims": "4.0.0-beta-*",
+ "System.Security.Principal": "4.0.0-beta-*",
+ "System.Threading.Tasks": "4.0.10-beta-*"
+ }
+ }
}
- }
-}
+}
\ No newline at end of file
diff --git a/src/Microsoft.AspNet.Owin/OwinEnvironment.cs b/src/Microsoft.AspNet.Owin/OwinEnvironment.cs
index 072f779b98..4e37f6b218 100644
--- a/src/Microsoft.AspNet.Owin/OwinEnvironment.cs
+++ b/src/Microsoft.AspNet.Owin/OwinEnvironment.cs
@@ -14,9 +14,8 @@ using System.Security.Principal;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.AspNet.Http;
-using Microsoft.AspNet.Http.Core.Authentication;
-using Microsoft.AspNet.Http;
using Microsoft.AspNet.Http.Authentication;
+using Microsoft.AspNet.Http.Core.Authentication;
namespace Microsoft.AspNet.Owin
{
diff --git a/src/Microsoft.AspNet.WebUtilities/QueryHelpers.cs b/src/Microsoft.AspNet.WebUtilities/QueryHelpers.cs
index 1414ef8f17..d7584b536a 100644
--- a/src/Microsoft.AspNet.WebUtilities/QueryHelpers.cs
+++ b/src/Microsoft.AspNet.WebUtilities/QueryHelpers.cs
@@ -4,6 +4,7 @@
using System;
using System.Collections.Generic;
using System.Text;
+using Microsoft.Framework.WebEncoders;
namespace Microsoft.AspNet.WebUtilities
{
@@ -19,7 +20,7 @@ namespace Microsoft.AspNet.WebUtilities
public static string AddQueryString([NotNull] string uri, [NotNull] string name, [NotNull] string value)
{
bool hasQuery = uri.IndexOf('?') != -1;
- return uri + (hasQuery ? "&" : "?") + Uri.EscapeDataString(name) + "=" + Uri.EscapeDataString(value);
+ return uri + (hasQuery ? "&" : "?") + UrlEncoder.Default.UrlEncode(name) + "=" + UrlEncoder.Default.UrlEncode(value);
}
///
@@ -36,9 +37,9 @@ namespace Microsoft.AspNet.WebUtilities
foreach (var parameter in queryString)
{
sb.Append(hasQuery ? '&' : '?');
- sb.Append(Uri.EscapeDataString(parameter.Key));
+ sb.Append(UrlEncoder.Default.UrlEncode(parameter.Key));
sb.Append('=');
- sb.Append(Uri.EscapeDataString(parameter.Value));
+ sb.Append(UrlEncoder.Default.UrlEncode(parameter.Value));
hasQuery = true;
}
return sb.ToString();
diff --git a/src/Microsoft.AspNet.WebUtilities/project.json b/src/Microsoft.AspNet.WebUtilities/project.json
index 45068efbf3..19bedc2195 100644
--- a/src/Microsoft.AspNet.WebUtilities/project.json
+++ b/src/Microsoft.AspNet.WebUtilities/project.json
@@ -2,6 +2,7 @@
"version": "1.0.0-*",
"description": "ASP.NET 5 common helper methods.",
"dependencies": {
+ "Microsoft.Framework.WebEncoders.Core": "1.0.0-*"
},
"frameworks": {
"dnx451": { },