OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2006 Alexey Proskuryakov (ap@webkit.org) | 2 * Copyright (C) 2006 Alexey Proskuryakov (ap@webkit.org) |
3 * Copyright (C) 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. | 3 * Copyright (C) 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. |
4 * Copyright (C) 2009 Torch Mobile Inc. http://www.torchmobile.com/ | 4 * Copyright (C) 2009 Torch Mobile Inc. http://www.torchmobile.com/ |
5 * Copyright (C) 2009 Google Inc. All rights reserved. | 5 * Copyright (C) 2009 Google Inc. All rights reserved. |
6 * Copyright (C) 2011 Apple Inc. All Rights Reserved. | 6 * Copyright (C) 2011 Apple Inc. All Rights Reserved. |
7 * | 7 * |
8 * Redistribution and use in source and binary forms, with or without | 8 * Redistribution and use in source and binary forms, with or without |
9 * modification, are permitted provided that the following conditions | 9 * modification, are permitted provided that the following conditions |
10 * are met: | 10 * are met: |
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
274 | 274 |
275 Vector<String> parameters; | 275 Vector<String> parameters; |
276 content_disposition.Split(';', parameters); | 276 content_disposition.Split(';', parameters); |
277 | 277 |
278 if (parameters.IsEmpty()) | 278 if (parameters.IsEmpty()) |
279 return kContentDispositionNone; | 279 return kContentDispositionNone; |
280 | 280 |
281 String disposition_type = parameters[0]; | 281 String disposition_type = parameters[0]; |
282 disposition_type.StripWhiteSpace(); | 282 disposition_type.StripWhiteSpace(); |
283 | 283 |
284 if (EqualIgnoringCase(disposition_type, "inline")) | 284 if (DeprecatedEqualIgnoringCase(disposition_type, "inline")) |
285 return kContentDispositionInline; | 285 return kContentDispositionInline; |
286 | 286 |
287 // Some broken sites just send bogus headers like | 287 // Some broken sites just send bogus headers like |
288 // | 288 // |
289 // Content-Disposition: ; filename="file" | 289 // Content-Disposition: ; filename="file" |
290 // Content-Disposition: filename="file" | 290 // Content-Disposition: filename="file" |
291 // Content-Disposition: name="file" | 291 // Content-Disposition: name="file" |
292 // | 292 // |
293 // without a disposition token... screen those out. | 293 // without a disposition token... screen those out. |
294 if (!IsValidHTTPToken(disposition_type)) | 294 if (!IsValidHTTPToken(disposition_type)) |
(...skipping 415 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
710 static const char kMaxAgeDirective[] = "max-age"; | 710 static const char kMaxAgeDirective[] = "max-age"; |
711 | 711 |
712 if (!cache_control_value.IsEmpty()) { | 712 if (!cache_control_value.IsEmpty()) { |
713 Vector<std::pair<String, String>> directives; | 713 Vector<std::pair<String, String>> directives; |
714 ParseCacheHeader(cache_control_value, directives); | 714 ParseCacheHeader(cache_control_value, directives); |
715 | 715 |
716 size_t directives_size = directives.size(); | 716 size_t directives_size = directives.size(); |
717 for (size_t i = 0; i < directives_size; ++i) { | 717 for (size_t i = 0; i < directives_size; ++i) { |
718 // RFC2616 14.9.1: A no-cache directive with a value is only meaningful | 718 // RFC2616 14.9.1: A no-cache directive with a value is only meaningful |
719 // for proxy caches. It should be ignored by a browser level cache. | 719 // for proxy caches. It should be ignored by a browser level cache. |
720 if (EqualIgnoringCase(directives[i].first, kNoCacheDirective) && | 720 if (DeprecatedEqualIgnoringCase(directives[i].first, kNoCacheDirective) && |
721 directives[i].second.IsEmpty()) { | 721 directives[i].second.IsEmpty()) { |
722 cache_control_header.contains_no_cache = true; | 722 cache_control_header.contains_no_cache = true; |
723 } else if (EqualIgnoringCase(directives[i].first, kNoStoreDirective)) { | 723 } else if (DeprecatedEqualIgnoringCase(directives[i].first, |
| 724 kNoStoreDirective)) { |
724 cache_control_header.contains_no_store = true; | 725 cache_control_header.contains_no_store = true; |
725 } else if (EqualIgnoringCase(directives[i].first, | 726 } else if (DeprecatedEqualIgnoringCase(directives[i].first, |
726 kMustRevalidateDirective)) { | 727 kMustRevalidateDirective)) { |
727 cache_control_header.contains_must_revalidate = true; | 728 cache_control_header.contains_must_revalidate = true; |
728 } else if (EqualIgnoringCase(directives[i].first, kMaxAgeDirective)) { | 729 } else if (DeprecatedEqualIgnoringCase(directives[i].first, |
| 730 kMaxAgeDirective)) { |
729 if (!std::isnan(cache_control_header.max_age)) { | 731 if (!std::isnan(cache_control_header.max_age)) { |
730 // First max-age directive wins if there are multiple ones. | 732 // First max-age directive wins if there are multiple ones. |
731 continue; | 733 continue; |
732 } | 734 } |
733 bool ok; | 735 bool ok; |
734 double max_age = directives[i].second.ToDouble(&ok); | 736 double max_age = directives[i].second.ToDouble(&ok); |
735 if (ok) | 737 if (ok) |
736 cache_control_header.max_age = max_age; | 738 cache_control_header.max_age = max_age; |
737 } | 739 } |
738 } | 740 } |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
868 bool ParseContentRangeHeaderFor206(const String& content_range, | 870 bool ParseContentRangeHeaderFor206(const String& content_range, |
869 int64_t* first_byte_position, | 871 int64_t* first_byte_position, |
870 int64_t* last_byte_position, | 872 int64_t* last_byte_position, |
871 int64_t* instance_length) { | 873 int64_t* instance_length) { |
872 return net::HttpUtil::ParseContentRangeHeaderFor206( | 874 return net::HttpUtil::ParseContentRangeHeaderFor206( |
873 StringUTF8Adaptor(content_range).AsStringPiece(), first_byte_position, | 875 StringUTF8Adaptor(content_range).AsStringPiece(), first_byte_position, |
874 last_byte_position, instance_length); | 876 last_byte_position, instance_length); |
875 } | 877 } |
876 | 878 |
877 } // namespace blink | 879 } // namespace blink |
OLD | NEW |