| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "modules/fetch/FetchHeaderList.h" | 5 #include "modules/fetch/FetchHeaderList.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <utility> | 8 #include <utility> |
| 9 #include "platform/loader/fetch/FetchUtils.h" | 9 #include "platform/loader/fetch/FetchUtils.h" |
| 10 #include "platform/network/HTTPParsers.h" | 10 #include "platform/network/HTTPParsers.h" |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 // 2. Otherwise, append a new header whose name is |name| and value is | 92 // 2. Otherwise, append a new header whose name is |name| and value is |
| 93 // |value| to |list|." | 93 // |value| to |list|." |
| 94 StringBuilder resultBuilder; | 94 StringBuilder resultBuilder; |
| 95 bool found = false; | 95 bool found = false; |
| 96 auto range = header_list_.equal_range(name); | 96 auto range = header_list_.equal_range(name); |
| 97 for (auto header = range.first; header != range.second; ++header) { | 97 for (auto header = range.first; header != range.second; ++header) { |
| 98 if (!found) { | 98 if (!found) { |
| 99 resultBuilder.Append(header->second); | 99 resultBuilder.Append(header->second); |
| 100 found = true; | 100 found = true; |
| 101 } else { | 101 } else { |
| 102 // TODO(rakuco): This must be ", " instead. crbug.com/700434. | 102 resultBuilder.Append(", "); |
| 103 resultBuilder.Append(','); | |
| 104 resultBuilder.Append(header->second); | 103 resultBuilder.Append(header->second); |
| 105 } | 104 } |
| 106 } | 105 } |
| 107 if (found) | 106 if (found) |
| 108 result = resultBuilder.ToString(); | 107 result = resultBuilder.ToString(); |
| 109 return found; | 108 return found; |
| 110 } | 109 } |
| 111 | 110 |
| 112 // This is going to be removed: see crbug.com/645492. | 111 // This is going to be removed: see crbug.com/645492. |
| 113 void FetchHeaderList::GetAll(const String& name, Vector<String>& result) const { | 112 void FetchHeaderList::GetAll(const String& name, Vector<String>& result) const { |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 166 return IsValidHTTPToken(name); | 165 return IsValidHTTPToken(name); |
| 167 } | 166 } |
| 168 | 167 |
| 169 bool FetchHeaderList::IsValidHeaderValue(const String& value) { | 168 bool FetchHeaderList::IsValidHeaderValue(const String& value) { |
| 170 // "A value is a byte sequence that matches the field-value token production | 169 // "A value is a byte sequence that matches the field-value token production |
| 171 // and contains no 0x0A or 0x0D bytes." | 170 // and contains no 0x0A or 0x0D bytes." |
| 172 return IsValidHTTPHeaderValue(value); | 171 return IsValidHTTPHeaderValue(value); |
| 173 } | 172 } |
| 174 | 173 |
| 175 } // namespace blink | 174 } // namespace blink |
| OLD | NEW |