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

Unified Diff: net/http/http_util.h

Issue 2753453003: Reject unadvertised encodings (Closed)
Patch Set: Extracted code for UMA reporting Created 3 years, 9 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
Index: net/http/http_util.h
diff --git a/net/http/http_util.h b/net/http/http_util.h
index 267b96400943335283e3c4e5883b4660e7c7e65c..ce842032423a89b76e79d9578dff856e20da1671 100644
--- a/net/http/http_util.h
+++ b/net/http/http_util.h
@@ -8,6 +8,7 @@
#include <stddef.h>
#include <stdint.h>
+#include <set>
#include <string>
#include <vector>
@@ -230,6 +231,18 @@ class NET_EXPORT HttpUtil {
// returned by GetStatusCodesForHistogram.
static int MapStatusCodeForHistogram(int code);
+ // Returns true if |accept_encoding| is well-formed. Parsed encodings turned
+ // to lower case, are placed to provided string-set. Resulting set is
+ // augmented to fulfill the RFC 2616 (sections 14.3 and 3.9) recommendations.
+ static bool ParseAcceptEncoding(const std::string& accept_encoding,
+ std::set<std::string>* allowed_encodings);
+
+ // Returns true if |content_encoding| is well-formed. Parsed encodings turned
+ // to lower case, are placed to provided string-set. See sections 14.11 and
+ // 3.5 of RFC 2616.
+ static bool ParseContentEncoding(const std::string& content_encoding,
+ std::set<std::string>* used_encodings);
+
// Used to iterate over the name/value pairs of HTTP headers. To iterate
// over the values in a multi-value header, use ValuesIterator.
// See AssembleRawHeaders for joining line continuations (this iterator

Powered by Google App Engine
This is Rietveld 408576698