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

Unified Diff: net/server/http_server_request_info.cc

Issue 274813002: HttpServer: Handling of multiple header fields with the same name and multiple values of "Connectio… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Moved header value splitting to HttpServerRequestInfo::HasHeaderValue Created 6 years, 7 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/server/http_server_request_info.cc
diff --git a/net/server/http_server_request_info.cc b/net/server/http_server_request_info.cc
index 67965f29aa34302e03161e86e5ed5680db260ded..1ed7028d83f52e128892003b9b151c34a5373d23 100644
--- a/net/server/http_server_request_info.cc
+++ b/net/server/http_server_request_info.cc
@@ -22,4 +22,21 @@ std::string HttpServerRequestInfo::GetHeaderValue(
return std::string();
}
+bool HttpServerRequestInfo::HasHeaderValue(
+ const std::string& header_name,
+ const std::string& header_value) const {
+ DCHECK_EQ(StringToLowerASCII(header_value), header_value);
+ std::string complete_value = GetHeaderValue(header_name);
+ StringToLowerASCII(&complete_value);
+ std::vector<std::string> value_items;
+ Tokenize(complete_value, ",", &value_items);
+ for (std::vector<std::string>::iterator it = value_items.begin();
+ it != value_items.end(); ++it) {
+ base::TrimString(*it, " \t", &*it);
+ if (*it == "upgrade")
pfeldman 2014/05/08 15:19:16 This should be header_value. Your test below shoul
+ return true;
+ }
+ return false;
+}
+
} // namespace net

Powered by Google App Engine
This is Rietveld 408576698