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

Unified Diff: third_party/WebKit/Source/modules/fetch/FetchHeaderList.cpp

Issue 2587463002: [Fetch API] Appending headers of the same name should have their values (Closed)
Patch Set: flag to found Created 4 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: third_party/WebKit/Source/modules/fetch/FetchHeaderList.cpp
diff --git a/third_party/WebKit/Source/modules/fetch/FetchHeaderList.cpp b/third_party/WebKit/Source/modules/fetch/FetchHeaderList.cpp
index ca24581c50d6d8947f534060708b79cfea3f77c1..f87594ea0788b4b073305d3064392366d00ce2f0 100644
--- a/third_party/WebKit/Source/modules/fetch/FetchHeaderList.cpp
+++ b/third_party/WebKit/Source/modules/fetch/FetchHeaderList.cpp
@@ -87,13 +87,20 @@ void FetchHeaderList::remove(const String& name) {
bool FetchHeaderList::get(const String& name, String& result) const {
const String lowercasedName = name.lower();
- for (size_t i = 0; i < m_headerList.size(); ++i) {
- if (m_headerList[i]->first == lowercasedName) {
- result = m_headerList[i]->second;
- return true;
+ bool found = false;
+ for (const auto& header : m_headerList) {
+ if (header->first == lowercasedName) {
+ if (!found) {
+ result = "";
+ result.append(header->second);
+ found = true;
+ } else {
+ result.append(",");
+ result.append(header->second);
+ }
}
}
- return false;
+ return found;
}
void FetchHeaderList::getAll(const String& name, Vector<String>& result) const {

Powered by Google App Engine
This is Rietveld 408576698