| OLD | NEW |
| 1 /* | 1 /* |
| 2 Copyright (C) 1998 Lars Knoll (knoll@mpi-hd.mpg.de) | 2 Copyright (C) 1998 Lars Knoll (knoll@mpi-hd.mpg.de) |
| 3 Copyright (C) 2001 Dirk Mueller (mueller@kde.org) | 3 Copyright (C) 2001 Dirk Mueller (mueller@kde.org) |
| 4 Copyright (C) 2002 Waldo Bastian (bastian@kde.org) | 4 Copyright (C) 2002 Waldo Bastian (bastian@kde.org) |
| 5 Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com) | 5 Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com) |
| 6 Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All
rights reserved. | 6 Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All
rights reserved. |
| 7 | 7 |
| 8 This library is free software; you can redistribute it and/or | 8 This library is free software; you can redistribute it and/or |
| 9 modify it under the terms of the GNU Library General Public | 9 modify it under the terms of the GNU Library General Public |
| 10 License as published by the Free Software Foundation; either | 10 License as published by the Free Software Foundation; either |
| (...skipping 527 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 538 | 538 |
| 539 const ResourceRequest& Resource::lastResourceRequest() const | 539 const ResourceRequest& Resource::lastResourceRequest() const |
| 540 { | 540 { |
| 541 if (!m_redirectChain.size()) | 541 if (!m_redirectChain.size()) |
| 542 return m_resourceRequest; | 542 return m_resourceRequest; |
| 543 return m_redirectChain.last().m_request; | 543 return m_redirectChain.last().m_request; |
| 544 } | 544 } |
| 545 | 545 |
| 546 void Resource::setRevalidatingRequest(const ResourceRequest& request) | 546 void Resource::setRevalidatingRequest(const ResourceRequest& request) |
| 547 { | 547 { |
| 548 SECURITY_CHECK(m_redirectChain.isEmpty()); |
| 548 m_revalidatingRequest = request; | 549 m_revalidatingRequest = request; |
| 549 m_status = NotStarted; | 550 m_status = NotStarted; |
| 550 } | 551 } |
| 551 | 552 |
| 552 void Resource::willFollowRedirect(ResourceRequest& newRequest, const ResourceRes
ponse& redirectResponse) | 553 void Resource::willFollowRedirect(ResourceRequest& newRequest, const ResourceRes
ponse& redirectResponse) |
| 553 { | 554 { |
| 554 newRequest.setAllowStoredCredentials(m_options.allowCredentials == AllowStor
edCredentials); | 555 newRequest.setAllowStoredCredentials(m_options.allowCredentials == AllowStor
edCredentials); |
| 555 m_redirectChain.append(RedirectPair(newRequest, redirectResponse)); | 556 m_redirectChain.append(RedirectPair(newRequest, redirectResponse)); |
| 556 } | 557 } |
| 557 | 558 |
| (...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 889 memoryDump->addSuballocation(overheadDump->guid(), String(WTF::Partitions::k
AllocatedObjectPoolName)); | 890 memoryDump->addSuballocation(overheadDump->guid(), String(WTF::Partitions::k
AllocatedObjectPoolName)); |
| 890 } | 891 } |
| 891 | 892 |
| 892 String Resource::getMemoryDumpName() const | 893 String Resource::getMemoryDumpName() const |
| 893 { | 894 { |
| 894 return String::format("web_cache/%s_resources/%ld", resourceTypeToString(get
Type(), options().initiatorInfo), m_identifier); | 895 return String::format("web_cache/%s_resources/%ld", resourceTypeToString(get
Type(), options().initiatorInfo), m_identifier); |
| 895 } | 896 } |
| 896 | 897 |
| 897 void Resource::revalidationSucceeded(const ResourceResponse& validatingResponse) | 898 void Resource::revalidationSucceeded(const ResourceResponse& validatingResponse) |
| 898 { | 899 { |
| 900 SECURITY_CHECK(m_redirectChain.isEmpty()); |
| 901 SECURITY_CHECK(validatingResponse.url() == m_response.url()); |
| 899 m_response.setResourceLoadTiming(validatingResponse.resourceLoadTiming()); | 902 m_response.setResourceLoadTiming(validatingResponse.resourceLoadTiming()); |
| 900 | 903 |
| 901 // RFC2616 10.3.5 | 904 // RFC2616 10.3.5 |
| 902 // Update cached headers from the 304 response | 905 // Update cached headers from the 304 response |
| 903 const HTTPHeaderMap& newHeaders = validatingResponse.httpHeaderFields(); | 906 const HTTPHeaderMap& newHeaders = validatingResponse.httpHeaderFields(); |
| 904 for (const auto& header : newHeaders) { | 907 for (const auto& header : newHeaders) { |
| 905 // Entity headers should not be sent by servers when generating a 304 | 908 // Entity headers should not be sent by servers when generating a 304 |
| 906 // response; misconfigured servers send them anyway. We shouldn't allow | 909 // response; misconfigured servers send them anyway. We shouldn't allow |
| 907 // such headers to update the original request. We'll base this on the | 910 // such headers to update the original request. We'll base this on the |
| 908 // list defined by RFC2616 7.1, with a few additions for extension heade
rs | 911 // list defined by RFC2616 7.1, with a few additions for extension heade
rs |
| 909 // we care about. | 912 // we care about. |
| 910 if (!shouldUpdateHeaderAfterRevalidation(header.key)) | 913 if (!shouldUpdateHeaderAfterRevalidation(header.key)) |
| 911 continue; | 914 continue; |
| 912 m_response.setHTTPHeaderField(header.key, header.value); | 915 m_response.setHTTPHeaderField(header.key, header.value); |
| 913 } | 916 } |
| 914 | 917 |
| 915 m_resourceRequest = m_revalidatingRequest; | 918 m_resourceRequest = m_revalidatingRequest; |
| 916 m_revalidatingRequest = ResourceRequest(); | 919 m_revalidatingRequest = ResourceRequest(); |
| 917 } | 920 } |
| 918 | 921 |
| 919 void Resource::revalidationFailed() | 922 void Resource::revalidationFailed() |
| 920 { | 923 { |
| 921 m_resourceRequest = m_revalidatingRequest; | 924 m_resourceRequest = m_revalidatingRequest; |
| 922 m_revalidatingRequest = ResourceRequest(); | 925 m_revalidatingRequest = ResourceRequest(); |
| 923 m_redirectChain.clear(); | 926 SECURITY_CHECK(m_redirectChain.isEmpty()); |
| 924 m_data.clear(); | 927 m_data.clear(); |
| 925 m_cacheHandler.clear(); | 928 m_cacheHandler.clear(); |
| 926 destroyDecodedDataForFailedRevalidation(); | 929 destroyDecodedDataForFailedRevalidation(); |
| 927 } | 930 } |
| 928 | 931 |
| 929 bool Resource::canReuseRedirectChain() | 932 bool Resource::canReuseRedirectChain() |
| 930 { | 933 { |
| 931 for (auto& redirect : m_redirectChain) { | 934 for (auto& redirect : m_redirectChain) { |
| 932 if (!canUseResponse(redirect.m_redirectResponse, m_responseTimestamp)) | 935 if (!canUseResponse(redirect.m_redirectResponse, m_responseTimestamp)) |
| 933 return false; | 936 return false; |
| (...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1121 case Resource::Media: | 1124 case Resource::Media: |
| 1122 return "Media"; | 1125 return "Media"; |
| 1123 case Resource::Manifest: | 1126 case Resource::Manifest: |
| 1124 return "Manifest"; | 1127 return "Manifest"; |
| 1125 } | 1128 } |
| 1126 ASSERT_NOT_REACHED(); | 1129 ASSERT_NOT_REACHED(); |
| 1127 return "Unknown"; | 1130 return "Unknown"; |
| 1128 } | 1131 } |
| 1129 | 1132 |
| 1130 } // namespace blink | 1133 } // namespace blink |
| OLD | NEW |