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

Unified Diff: net/http/http_content_disposition.h

Issue 11478034: Add UMA for measuring Content-Dispostion header use and abuse. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Only measure valid C-D headers Created 8 years 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
Index: net/http/http_content_disposition.h
diff --git a/net/http/http_content_disposition.h b/net/http/http_content_disposition.h
index f3573a9dceadcc27a6c9c54e8b7c0452b4f3e2a4..580f9046e82de212461a8b990e6c6187a30646d0 100644
--- a/net/http/http_content_disposition.h
+++ b/net/http/http_content_disposition.h
@@ -19,6 +19,37 @@ class NET_EXPORT HttpContentDisposition {
ATTACHMENT,
};
+ // Properties of the Content-Disposition header. Used for UMA.
+ struct ParseResult {
+ ParseResult();
+
+ // A valid disposition-type was present.
+ bool has_disposition_type;
+
+ // The disposition-type was not 'inline' or 'attachment'.
+ bool has_unknown_disposition_type;
+
+ // Has a valid non-empty 'name' attribute.
+ bool has_name;
+
+ // Has a valid non-empty 'filename' attribute.
+ bool has_filename;
+
+ // Has a valid non-empty 'filename*' attribute.
+ bool has_ext_filename;
+
+ // The following fields are properties of the 'filename' attribute:
+
+ // quoted-string contained non-ASCII characters.
rvargas (doing something else) 2012/12/14 22:49:54 nit: I know why you do it this way, but do you min
asanka 2012/12/15 01:57:32 Done.
+ bool has_non_ascii_strings;
+
+ // quoted-string contained percent-encoding.
+ bool has_percent_encoded_strings;
+
+ // quoted-string contained RFC 2047 encoded words.
+ bool has_rfc2047_encoded_strings;
+ };
+
HttpContentDisposition(const std::string& header,
const std::string& referrer_charset);
~HttpContentDisposition();
@@ -28,6 +59,8 @@ class NET_EXPORT HttpContentDisposition {
Type type() const { return type_; }
const std::string& filename() const { return filename_; }
+ const ParseResult& parse_result() const { return parse_result_; }
+
private:
void Parse(const std::string& header, const std::string& referrer_charset);
std::string::const_iterator ConsumeDispositionType(
@@ -35,6 +68,7 @@ class NET_EXPORT HttpContentDisposition {
Type type_;
std::string filename_;
+ ParseResult parse_result_;
DISALLOW_COPY_AND_ASSIGN(HttpContentDisposition);
};

Powered by Google App Engine
This is Rietveld 408576698