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

Unified Diff: third_party/WebKit/Source/platform/network/ParsedContentType.cpp

Issue 2708043002: ParsedContentType parameter name matching should be case insensitive (Closed)
Patch Set: done Created 3 years, 10 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 | « no previous file | third_party/WebKit/Source/platform/network/ParsedContentTypeTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/platform/network/ParsedContentType.cpp
diff --git a/third_party/WebKit/Source/platform/network/ParsedContentType.cpp b/third_party/WebKit/Source/platform/network/ParsedContentType.cpp
index e7e6880b9c89d4f80af199899a1511082274730b..57d3943787f6781dd14188e5dc4cf3a386e21b60 100644
--- a/third_party/WebKit/Source/platform/network/ParsedContentType.cpp
+++ b/third_party/WebKit/Source/platform/network/ParsedContentType.cpp
@@ -164,7 +164,9 @@ String ParsedContentType::charset() const {
}
String ParsedContentType::parameterValueForName(const String& name) const {
- return m_parameters.get(name);
+ if (!name.containsOnlyASCII())
+ return String();
+ return m_parameters.get(name.lower());
}
size_t ParsedContentType::parameterCount() const {
@@ -262,7 +264,11 @@ bool ParsedContentType::parse(const String& contentType) {
<< ", for '" << key.toString() << "').";
return false;
}
- map.set(key.toString(), value);
+ String keyString = key.toString();
+ // As |key| is parsed as a token, it consists of ascii characters
+ // and hence we don't need to care about non-ascii lowercasing.
+ DCHECK(keyString.containsOnlyASCII());
+ map.set(keyString.lower(), value);
}
m_parameters = std::move(map);
return true;
« no previous file with comments | « no previous file | third_party/WebKit/Source/platform/network/ParsedContentTypeTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698