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

Side by Side Diff: net/tools/dump_cache/cache_dumper.cc

Issue 197016: Http Cache: Add support for resuming downloading a... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 3 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 | « net/http/partial_data.cc ('k') | net/url_request/url_request_view_cache_job.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) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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/tools/dump_cache/cache_dumper.h" 5 #include "net/tools/dump_cache/cache_dumper.h"
6 6
7 #include "net/base/io_buffer.h" 7 #include "net/base/io_buffer.h"
8 #include "net/disk_cache/entry_impl.h" 8 #include "net/disk_cache/entry_impl.h"
9 #include "net/http/http_cache.h" 9 #include "net/http/http_cache.h"
10 #include "net/http/http_response_headers.h" 10 #include "net/http/http_response_headers.h"
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 bool DiskDumper::WriteEntry(disk_cache::Entry* entry, int index, int offset, 132 bool DiskDumper::WriteEntry(disk_cache::Entry* entry, int index, int offset,
133 net::IOBuffer* buf, int buf_len) { 133 net::IOBuffer* buf, int buf_len) {
134 if (!entry_) 134 if (!entry_)
135 return false; 135 return false;
136 136
137 std::string headers; 137 std::string headers;
138 const char *data; 138 const char *data;
139 int len; 139 int len;
140 if (index == 0) { // Stream 0 is the headers. 140 if (index == 0) { // Stream 0 is the headers.
141 net::HttpResponseInfo response_info; 141 net::HttpResponseInfo response_info;
142 bool truncated;
142 if (!net::HttpCache::ParseResponseInfo(buf->data(), buf_len, 143 if (!net::HttpCache::ParseResponseInfo(buf->data(), buf_len,
143 &response_info)) 144 &response_info, &truncated))
144 return false; 145 return false;
145 146
147 // Skip this entry if it was truncated (results in an empty file).
148 if (truncated)
149 return true;
150
146 // Remove the size headers. 151 // Remove the size headers.
147 response_info.headers->RemoveHeader("transfer-encoding"); 152 response_info.headers->RemoveHeader("transfer-encoding");
148 response_info.headers->RemoveHeader("content-length"); 153 response_info.headers->RemoveHeader("content-length");
149 response_info.headers->RemoveHeader("x-original-url"); 154 response_info.headers->RemoveHeader("x-original-url");
150 155
151 // Convert the headers into a string ending with LF. 156 // Convert the headers into a string ending with LF.
152 GetNormalizedHeaders(response_info, &headers); 157 GetNormalizedHeaders(response_info, &headers);
153 158
154 // Append a header for the original URL. 159 // Append a header for the original URL.
155 std::string url = entry_url_; 160 std::string url = entry_url_;
(...skipping 25 matching lines...) Expand all
181 186
182 void DiskDumper::CloseEntry(disk_cache::Entry* entry, base::Time last_used, 187 void DiskDumper::CloseEntry(disk_cache::Entry* entry, base::Time last_used,
183 base::Time last_modified) { 188 base::Time last_modified) {
184 #ifdef WIN32_LARGE_FILENAME_SUPPORT 189 #ifdef WIN32_LARGE_FILENAME_SUPPORT
185 CloseHandle(entry_); 190 CloseHandle(entry_);
186 #else 191 #else
187 file_util::CloseFile(entry_); 192 file_util::CloseFile(entry_);
188 #endif 193 #endif
189 } 194 }
190 195
OLDNEW
« no previous file with comments | « net/http/partial_data.cc ('k') | net/url_request/url_request_view_cache_job.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698