OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 // The rules for parsing content-types were borrowed from Firefox: | 5 // The rules for parsing content-types were borrowed from Firefox: |
6 // http://lxr.mozilla.org/mozilla/source/netwerk/base/src/nsURLHelper.cpp#834 | 6 // http://lxr.mozilla.org/mozilla/source/netwerk/base/src/nsURLHelper.cpp#834 |
7 | 7 |
8 #include "net/http/http_util.h" | 8 #include "net/http/http_util.h" |
9 | 9 |
10 #include <algorithm> | 10 #include <algorithm> |
(...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
376 } | 376 } |
377 return stripped_headers; | 377 return stripped_headers; |
378 } | 378 } |
379 | 379 |
380 // static | 380 // static |
381 bool HttpUtil::IsNonCoalescingHeader(std::string::const_iterator name_begin, | 381 bool HttpUtil::IsNonCoalescingHeader(std::string::const_iterator name_begin, |
382 std::string::const_iterator name_end) { | 382 std::string::const_iterator name_end) { |
383 // NOTE: "set-cookie2" headers do not support expires attributes, so we don't | 383 // NOTE: "set-cookie2" headers do not support expires attributes, so we don't |
384 // have to list them here. | 384 // have to list them here. |
385 const char* const kNonCoalescingHeaders[] = { | 385 const char* const kNonCoalescingHeaders[] = { |
386 "date", | 386 "date", "expires", "last-modified", |
387 "expires", | 387 "location", // See bug 1050541 for details |
388 "last-modified", | 388 "retry-after", "set-cookie", |
389 "location", // See bug 1050541 for details | 389 // The format of auth-challenges mixes both space separated tokens and |
390 "retry-after", | 390 // comma separated properties, so coalescing on comma won't work. |
391 "set-cookie", | 391 "www-authenticate", "proxy-authenticate", |
392 // The format of auth-challenges mixes both space separated tokens and | 392 // STS specifies that UAs must not process any STS headers after the first |
393 // comma separated properties, so coalescing on comma won't work. | 393 // one. |
394 "www-authenticate", | 394 "strict-transport-security", |
395 "proxy-authenticate", | 395 // The Clear-Site-Data header value is a JSON dictionary. JSON |
396 // STS specifies that UAs must not process any STS headers after the first | 396 // dictionaries are not closed under merging or splitting on commas. |
397 // one. | 397 "clear-site-data", |
398 "strict-transport-security" | |
399 }; | 398 }; |
400 for (size_t i = 0; i < arraysize(kNonCoalescingHeaders); ++i) { | 399 for (size_t i = 0; i < arraysize(kNonCoalescingHeaders); ++i) { |
401 if (base::LowerCaseEqualsASCII(base::StringPiece(name_begin, name_end), | 400 if (base::LowerCaseEqualsASCII(base::StringPiece(name_begin, name_end), |
402 kNonCoalescingHeaders[i])) | 401 kNonCoalescingHeaders[i])) |
403 return true; | 402 return true; |
404 } | 403 } |
405 return false; | 404 return false; |
406 } | 405 } |
407 | 406 |
408 bool HttpUtil::IsLWS(char c) { | 407 bool HttpUtil::IsLWS(char c) { |
(...skipping 644 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1053 return true; | 1052 return true; |
1054 } | 1053 } |
1055 | 1054 |
1056 bool HttpUtil::NameValuePairsIterator::IsQuote(char c) const { | 1055 bool HttpUtil::NameValuePairsIterator::IsQuote(char c) const { |
1057 if (strict_quotes_) | 1056 if (strict_quotes_) |
1058 return c == '"'; | 1057 return c == '"'; |
1059 return HttpUtil::IsQuote(c); | 1058 return HttpUtil::IsQuote(c); |
1060 } | 1059 } |
1061 | 1060 |
1062 } // namespace net | 1061 } // namespace net |
OLD | NEW |