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

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

Issue 464055: Merge 33919 - Http cache: Don't use multiple validation headers when... (Closed) Base URL: svn://svn.chromium.org/chrome/branches/249/src/
Patch Set: Created 11 years 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 | no next file » | 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_transaction.h" 5 #include "net/http/http_cache_transaction.h"
6 6
7 #include "base/compiler_specific.h" 7 #include "base/compiler_specific.h"
8 8
9 #if defined(OS_POSIX) 9 #if defined(OS_POSIX)
10 #include <unistd.h> 10 #include <unistd.h>
(...skipping 894 matching lines...) Expand 10 before | Expand all | Expand 10 after
905 if (!etag_value.empty()) { 905 if (!etag_value.empty()) {
906 if (partial_.get() && !partial_->IsCurrentRangeCached()) { 906 if (partial_.get() && !partial_->IsCurrentRangeCached()) {
907 // We don't want to switch to WRITE mode if we don't have this block of a 907 // We don't want to switch to WRITE mode if we don't have this block of a
908 // byte-range request because we may have other parts cached. 908 // byte-range request because we may have other parts cached.
909 custom_request_->extra_headers.append("If-Range: "); 909 custom_request_->extra_headers.append("If-Range: ");
910 } else { 910 } else {
911 custom_request_->extra_headers.append("If-None-Match: "); 911 custom_request_->extra_headers.append("If-None-Match: ");
912 } 912 }
913 custom_request_->extra_headers.append(etag_value); 913 custom_request_->extra_headers.append(etag_value);
914 custom_request_->extra_headers.append("\r\n"); 914 custom_request_->extra_headers.append("\r\n");
915 if (partial_.get() && partial_->IsCurrentRangeCached()) 915 // For byte-range requests, make sure that we use only one way to validate
916 // the request.
917 if (partial_.get())
916 return true; 918 return true;
917 } 919 }
918 920
919 if (!last_modified_value.empty()) { 921 if (!last_modified_value.empty()) {
920 if (partial_.get() && !partial_->IsCurrentRangeCached()) { 922 if (partial_.get() && !partial_->IsCurrentRangeCached()) {
921 custom_request_->extra_headers.append("If-Range: "); 923 custom_request_->extra_headers.append("If-Range: ");
922 } else { 924 } else {
923 custom_request_->extra_headers.append("If-Modified-Since: "); 925 custom_request_->extra_headers.append("If-Modified-Since: ");
924 } 926 }
925 custom_request_->extra_headers.append(last_modified_value); 927 custom_request_->extra_headers.append(last_modified_value);
(...skipping 471 matching lines...) Expand 10 before | Expand all | Expand 10 after
1397 void HttpCache::Transaction::OnCacheWriteCompleted(int result) { 1399 void HttpCache::Transaction::OnCacheWriteCompleted(int result) {
1398 DoCacheWriteCompleted(result); 1400 DoCacheWriteCompleted(result);
1399 } 1401 }
1400 1402
1401 void HttpCache::Transaction::OnCacheEntryReady(int result) { 1403 void HttpCache::Transaction::OnCacheEntryReady(int result) {
1402 DCHECK_EQ(OK, result); 1404 DCHECK_EQ(OK, result);
1403 ValidateEntryHeadersAndContinue(true); 1405 ValidateEntryHeadersAndContinue(true);
1404 } 1406 }
1405 1407
1406 } // namespace net 1408 } // namespace net
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698