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

Side by Side Diff: third_party/WebKit/Source/modules/fetch/FetchHeaderList.cpp

Issue 2835443002: Use LowerASCII() for MIME type lowering (Closed)
Patch Set: Created 3 years, 8 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 62
63 String FetchHeaderList::ExtractMIMEType() const { 63 String FetchHeaderList::ExtractMIMEType() const {
64 // To extract a MIME type from a header list (headers), run these steps: 64 // To extract a MIME type from a header list (headers), run these steps:
65 // 1. Let MIMEType be the result of parsing `Content-Type` in headers. 65 // 1. Let MIMEType be the result of parsing `Content-Type` in headers.
66 String mime_type; 66 String mime_type;
67 if (!Get("Content-Type", mime_type)) { 67 if (!Get("Content-Type", mime_type)) {
68 // 2. If MIMEType is null or failure, return the empty byte sequence. 68 // 2. If MIMEType is null or failure, return the empty byte sequence.
69 return String(); 69 return String();
70 } 70 }
71 // 3. Return MIMEType, byte lowercased. 71 // 3. Return MIMEType, byte lowercased.
72 return mime_type.DeprecatedLower(); 72 return mime_type.LowerASCII();
73 } 73 }
74 74
75 size_t FetchHeaderList::size() const { 75 size_t FetchHeaderList::size() const {
76 return header_list_.size(); 76 return header_list_.size();
77 } 77 }
78 78
79 void FetchHeaderList::Remove(const String& name) { 79 void FetchHeaderList::Remove(const String& name) {
80 // https://fetch.spec.whatwg.org/#concept-header-list-delete 80 // https://fetch.spec.whatwg.org/#concept-header-list-delete
81 // "To delete a name (name) from a header list (list), remove all headers 81 // "To delete a name (name) from a header list (list), remove all headers
82 // whose name is a byte-case-insensitive match for name from list." 82 // whose name is a byte-case-insensitive match for name from list."
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 return IsValidHTTPToken(name); 165 return IsValidHTTPToken(name);
166 } 166 }
167 167
168 bool FetchHeaderList::IsValidHeaderValue(const String& value) { 168 bool FetchHeaderList::IsValidHeaderValue(const String& value) {
169 // "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
170 // and contains no 0x0A or 0x0D bytes." 170 // and contains no 0x0A or 0x0D bytes."
171 return IsValidHTTPHeaderValue(value); 171 return IsValidHTTPHeaderValue(value);
172 } 172 }
173 173
174 } // namespace blink 174 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698