Index: sdk/lib/io/http_headers.dart |
diff --git a/sdk/lib/io/http_headers.dart b/sdk/lib/io/http_headers.dart |
index b355aa0c9273c14c46321fb0e48971b208efca56..27069761a08959d93a3e0ce7bd1337ba136cbdd2 100644 |
--- a/sdk/lib/io/http_headers.dart |
+++ b/sdk/lib/io/http_headers.dart |
@@ -482,10 +482,12 @@ class _HeaderValue implements HeaderValue { |
} |
} |
- static _HeaderValue parse(String value, {parameterSeparator: ";"}) { |
+ static _HeaderValue parse(String value, |
+ {parameterSeparator: ";", |
+ preserveBackslash: false}) { |
// Parse the string. |
var result = new _HeaderValue(); |
- result._parse(value, parameterSeparator); |
+ result._parse(value, parameterSeparator, preserveBackslash); |
return result; |
} |
@@ -516,7 +518,7 @@ class _HeaderValue implements HeaderValue { |
return sb.toString(); |
} |
- void _parse(String s, String parameterSeparator) { |
+ void _parse(String s, String parameterSeparator, bool preserveBackslash) { |
int index = 0; |
bool done() => index == s.length; |
@@ -569,10 +571,14 @@ class _HeaderValue implements HeaderValue { |
StringBuffer sb = new StringBuffer(); |
index++; |
while (!done()) { |
+ print(s[index]); |
if (s[index] == "\\") { |
if (index + 1 == s.length) { |
throw new HttpException("Failed to parse header value"); |
} |
+ if (preserveBackslash && s[index + 1] != "\"") { |
+ sb.write(s[index]); |
+ } |
index++; |
} else if (s[index] == "\"") { |
index++; |
@@ -641,7 +647,7 @@ class _ContentType extends _HeaderValue implements ContentType { |
static _ContentType parse(String value) { |
var result = new _ContentType._(); |
- result._parse(value, ";"); |
+ result._parse(value, ";", false); |
int index = result._value.indexOf("/"); |
if (index == -1 || index == (result._value.length - 1)) { |
result._primaryType = result._value.trim().toLowerCase(); |