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

Unified Diff: third_party/WebKit/Source/platform/network/HTTPParsers.cpp

Issue 2844353003: Use net::HttpContentTypeDisposition in blink (Closed)
Patch Set: fix Created 3 years, 8 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 | « third_party/WebKit/Source/platform/network/HTTPParsers.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/platform/network/HTTPParsers.cpp
diff --git a/third_party/WebKit/Source/platform/network/HTTPParsers.cpp b/third_party/WebKit/Source/platform/network/HTTPParsers.cpp
index 18f487bc2db5648460bfbd86bfe46e94c7e3d5c4..79fb0b837bc403129f3aae5d45d810d36f5031a2 100644
--- a/third_party/WebKit/Source/platform/network/HTTPParsers.cpp
+++ b/third_party/WebKit/Source/platform/network/HTTPParsers.cpp
@@ -32,6 +32,7 @@
#include "platform/network/HTTPParsers.h"
+#include "net/http/http_content_disposition.h"
#include "net/http/http_response_headers.h"
#include "net/http/http_util.h"
#include "platform/json/JSONParser.h"
@@ -267,37 +268,10 @@ bool IsValidHTTPToken(const String& characters) {
return true;
}
-ContentDispositionType GetContentDispositionType(
- const String& content_disposition) {
- if (content_disposition.IsEmpty())
- return kContentDispositionNone;
-
- Vector<String> parameters;
- content_disposition.Split(';', parameters);
-
- if (parameters.IsEmpty())
- return kContentDispositionNone;
-
- String disposition_type = parameters[0];
- disposition_type.StripWhiteSpace();
-
- if (DeprecatedEqualIgnoringCase(disposition_type, "inline"))
- return kContentDispositionInline;
-
- // Some broken sites just send bogus headers like
- //
- // Content-Disposition: ; filename="file"
- // Content-Disposition: filename="file"
- // Content-Disposition: name="file"
- //
- // without a disposition token... screen those out.
- if (!IsValidHTTPToken(disposition_type))
- return kContentDispositionNone;
-
- // We have a content-disposition of "attachment" or unknown.
- // RFC 2183, section 2.8 says that an unknown disposition
- // value should be treated as "attachment"
- return kContentDispositionAttachment;
+bool IsContentDispositionAttachment(const String& content_disposition) {
+ CString cstring(content_disposition.Utf8());
+ std::string string(cstring.data(), cstring.length());
+ return net::HttpContentDisposition(string, std::string()).is_attachment();
}
bool ParseHTTPRefresh(const String& refresh,
« no previous file with comments | « third_party/WebKit/Source/platform/network/HTTPParsers.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698