| 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 "core/fetch/FetchUtils.h" | 7 #include "core/fetch/FetchUtils.h" |
| 8 #include "platform/network/HTTPParsers.h" | 8 #include "platform/network/HTTPParsers.h" |
| 9 #include "wtf/PtrUtil.h" | 9 #include "wtf/PtrUtil.h" |
| 10 | 10 |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 m_headerList[i]->second = value; | 46 m_headerList[i]->second = value; |
| 47 for (size_t j = i + 1; j < m_headerList.size();) { | 47 for (size_t j = i + 1; j < m_headerList.size();) { |
| 48 if (m_headerList[j]->first == lowercasedName) | 48 if (m_headerList[j]->first == lowercasedName) |
| 49 m_headerList.remove(j); | 49 m_headerList.remove(j); |
| 50 else | 50 else |
| 51 ++j; | 51 ++j; |
| 52 } | 52 } |
| 53 return; | 53 return; |
| 54 } | 54 } |
| 55 } | 55 } |
| 56 m_headerList.append(wrapUnique(new Header(lowercasedName, value))); | 56 m_headerList.append(makeUnique<Header>(lowercasedName, value)); |
| 57 } | 57 } |
| 58 | 58 |
| 59 String FetchHeaderList::extractMIMEType() const { | 59 String FetchHeaderList::extractMIMEType() const { |
| 60 // To extract a MIME type from a header list (headers), run these steps: | 60 // To extract a MIME type from a header list (headers), run these steps: |
| 61 // 1. Let MIMEType be the result of parsing `Content-Type` in headers. | 61 // 1. Let MIMEType be the result of parsing `Content-Type` in headers. |
| 62 String mimeType; | 62 String mimeType; |
| 63 if (!get("Content-Type", mimeType)) { | 63 if (!get("Content-Type", mimeType)) { |
| 64 // 2. If MIMEType is null or failure, return the empty byte sequence. | 64 // 2. If MIMEType is null or failure, return the empty byte sequence. |
| 65 return String(); | 65 return String(); |
| 66 } | 66 } |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 132 return isValidHTTPToken(name); | 132 return isValidHTTPToken(name); |
| 133 } | 133 } |
| 134 | 134 |
| 135 bool FetchHeaderList::isValidHeaderValue(const String& value) { | 135 bool FetchHeaderList::isValidHeaderValue(const String& value) { |
| 136 // "A value is a byte sequence that matches the field-value token production | 136 // "A value is a byte sequence that matches the field-value token production |
| 137 // and contains no 0x0A or 0x0D bytes." | 137 // and contains no 0x0A or 0x0D bytes." |
| 138 return isValidHTTPHeaderValue(value); | 138 return isValidHTTPHeaderValue(value); |
| 139 } | 139 } |
| 140 | 140 |
| 141 } // namespace blink | 141 } // namespace blink |
| OLD | NEW |