| OLD | NEW |
| 1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2009 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 "net/http/http_cache.h" | 5 #include "net/http/http_cache.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
| 10 | 10 |
| (...skipping 1452 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1463 scoped_refptr<WrappedIOBuffer> data = new WrappedIOBuffer( | 1463 scoped_refptr<WrappedIOBuffer> data = new WrappedIOBuffer( |
| 1464 reinterpret_cast<const char*>(pickle.data())); | 1464 reinterpret_cast<const char*>(pickle.data())); |
| 1465 int len = static_cast<int>(pickle.size()); | 1465 int len = static_cast<int>(pickle.size()); |
| 1466 | 1466 |
| 1467 return disk_entry->WriteData(kResponseInfoIndex, 0, data, len, NULL, | 1467 return disk_entry->WriteData(kResponseInfoIndex, 0, data, len, NULL, |
| 1468 true) == len; | 1468 true) == len; |
| 1469 } | 1469 } |
| 1470 | 1470 |
| 1471 // Generate a key that can be used inside the cache. | 1471 // Generate a key that can be used inside the cache. |
| 1472 std::string HttpCache::GenerateCacheKey(const HttpRequestInfo* request) { | 1472 std::string HttpCache::GenerateCacheKey(const HttpRequestInfo* request) { |
| 1473 std::string url = request->url.spec(); | 1473 // Strip out the reference, username, and password sections of the URL. |
| 1474 if (request->url.has_ref()) | 1474 std::string url = HttpUtil::SpecForRequest(request->url); |
| 1475 url.erase(url.find_last_of('#')); | |
| 1476 | 1475 |
| 1477 DCHECK(mode_ != DISABLE); | 1476 DCHECK(mode_ != DISABLE); |
| 1478 if (mode_ == NORMAL) { | 1477 if (mode_ == NORMAL) { |
| 1479 // No valid URL can begin with numerals, so we should not have to worry | 1478 // No valid URL can begin with numerals, so we should not have to worry |
| 1480 // about collisions with normal URLs. | 1479 // about collisions with normal URLs. |
| 1481 if (request->upload_data && request->upload_data->identifier()) | 1480 if (request->upload_data && request->upload_data->identifier()) |
| 1482 url.insert(0, StringPrintf("%lld/", request->upload_data->identifier())); | 1481 url.insert(0, StringPrintf("%lld/", request->upload_data->identifier())); |
| 1483 return url; | 1482 return url; |
| 1484 } | 1483 } |
| 1485 | 1484 |
| (...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1797 static_cast<net::HttpNetworkLayer*>(network_layer_.get()); | 1796 static_cast<net::HttpNetworkLayer*>(network_layer_.get()); |
| 1798 HttpNetworkSession* session = network->GetSession(); | 1797 HttpNetworkSession* session = network->GetSession(); |
| 1799 if (session) { | 1798 if (session) { |
| 1800 session->connection_pool()->CloseIdleSockets(); | 1799 session->connection_pool()->CloseIdleSockets(); |
| 1801 } | 1800 } |
| 1802 } | 1801 } |
| 1803 | 1802 |
| 1804 //----------------------------------------------------------------------------- | 1803 //----------------------------------------------------------------------------- |
| 1805 | 1804 |
| 1806 } // namespace net | 1805 } // namespace net |
| OLD | NEW |