Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(278)

Unified Diff: sdk/lib/io/http_headers.dart

Issue 26973004: Preserve '\' in filenames for uploads, as Windows/IE contains them. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « sdk/lib/io/http.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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();
« no previous file with comments | « sdk/lib/io/http.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698