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

Unified Diff: net/http/http_util.h

Issue 2753453003: Reject unadvertised encodings (Closed)
Patch Set: Fix histo value comments 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 | « net/http/http_network_transaction_unittest.cc ('k') | net/http/http_util.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/http/http_util.h
diff --git a/net/http/http_util.h b/net/http/http_util.h
index 267b96400943335283e3c4e5883b4660e7c7e65c..cb3de359c1d58f101d0f08efdae5b5fd1721dbd9 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,21 @@ 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 and RFC 7231 recommendations, e.g. if
+ // there is no encodings specified, then {"*"} is returned to denote that
+ // client has to encoding preferences (but it does not imply that the
+ // user agent will be able to correctly process all encodings).
+ 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
« no previous file with comments | « net/http/http_network_transaction_unittest.cc ('k') | net/http/http_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698