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

Unified Diff: net/base/net_util.h

Issue 4435001: Add support for the extended header parameter syntax in Content-Disposition h... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 10 years, 1 month 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 | « base/i18n/icu_string_conversions_unittest.cc ('k') | net/base/net_util.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/base/net_util.h
===================================================================
--- net/base/net_util.h (revision 64006)
+++ net/base/net_util.h (working copy)
@@ -42,6 +42,18 @@
typedef uint32 FormatUrlType;
typedef uint32 FormatUrlTypes;
+// Used by GetHeaderParamValue to determine how to handle quotes in the value.
+class QuoteRule {
+ public:
+ enum Type {
+ KEEP_OUTER_QUOTES,
+ REMOVE_OUTER_QUOTES,
+ };
+
+ private:
+ QuoteRule();
+};
+
// Nothing is ommitted.
extern const FormatUrlType kFormatUrlOmitNothing;
@@ -124,23 +136,26 @@
// 'param_name'. Returns the empty string if the parameter is not found or is
// improperly formatted.
std::wstring GetHeaderParamValue(const std::wstring& field,
- const std::wstring& param_name);
+ const std::wstring& param_name,
+ QuoteRule::Type quote_rule);
std::string GetHeaderParamValue(const std::string& field,
- const std::string& param_name);
+ const std::string& param_name,
+ QuoteRule::Type quote_rule);
// Return the filename extracted from Content-Disposition header. The following
// formats are tried in order listed below:
//
-// 1. RFC 2047
-// 2. Raw-8bit-characters :
+// 1. RFC 5987
+// 2. RFC 2047
+// 3. Raw-8bit-characters :
// a. UTF-8, b. referrer_charset, c. default os codepage.
-// 3. %-escaped UTF-8.
+// 4. %-escaped UTF-8.
//
-// In step 2, if referrer_charset is empty(i.e. unknown), 2b is skipped.
-// In step 3, the fallback charsets tried in step 2 are not tried. We
+// In step 3, if referrer_charset is empty(i.e. unknown), 3b is skipped.
+// In step 4, the fallback charsets tried in step 3 are not tried. We
// can consider doing that later.
//
-// When a param value is ASCII, but is not in format #1 or format #3 above,
+// When a param value is ASCII, but is not in format #2 or format #4 above,
// it is returned as it is unless it's pretty close to two supported
// formats but not well-formed. In that case, an empty string is returned.
//
« no previous file with comments | « base/i18n/icu_string_conversions_unittest.cc ('k') | net/base/net_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698