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

Side by Side Diff: net/http/http_cache.cc

Issue 155972: Strip embedded "#" in URLs when constructing HTTP cache key.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Fix a typo from past change Created 11 years, 5 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | net/http/http_cache_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « no previous file | net/http/http_cache_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698