Chromium Code Reviews| 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..8b7c7a00d88ecb4e79b475d80f5423454277cc17 100644 |
| --- a/third_party/WebKit/Source/modules/fetch/FetchHeaderList.cpp |
| +++ b/third_party/WebKit/Source/modules/fetch/FetchHeaderList.cpp |
| @@ -87,13 +87,19 @@ 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 flag = false; |
| + for (const auto& header : m_headerList) { |
| + if (header->first == lowercasedName) { |
| + if (result.isEmpty()) { |
|
jsbell
2016/12/16 23:45:46
Shouldn't this test be (!flag) ?
|
| + result = header->second; |
| + flag = true; |
| + } else { |
| + result.append(","); |
| + result.append(header->second); |
| + } |
| } |
| } |
| - return false; |
| + return !result.isEmpty(); |
|
jsbell
2016/12/16 23:45:46
Won't this return false if there is only one match
dhna
2016/12/16 23:57:44
Oh it's my mistake sorry.
|
| } |
| void FetchHeaderList::getAll(const String& name, Vector<String>& result) const { |