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

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

Issue 154243006: Add GetExpirationTimes() to HttpResponseHeader. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: elide freshness origin Created 6 years, 10 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_response_headers.h » ('j') | net/http/http_response_headers.h » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "build/build_config.h" 7 #include "build/build_config.h"
8 8
9 #if defined(OS_POSIX) 9 #if defined(OS_POSIX)
10 #include <unistd.h> 10 #include <unistd.h>
(...skipping 1977 matching lines...) Expand 10 before | Expand all | Expand 10 after
1988 1988
1989 if (effective_load_flags_ & LOAD_PREFERRING_CACHE) 1989 if (effective_load_flags_ & LOAD_PREFERRING_CACHE)
1990 return false; 1990 return false;
1991 1991
1992 if (effective_load_flags_ & LOAD_VALIDATE_CACHE) 1992 if (effective_load_flags_ & LOAD_VALIDATE_CACHE)
1993 return true; 1993 return true;
1994 1994
1995 if (request_->method == "PUT" || request_->method == "DELETE") 1995 if (request_->method == "PUT" || request_->method == "DELETE")
1996 return true; 1996 return true;
1997 1997
1998 if (response_.headers->RequiresValidation( 1998 const Time freshness_expiry =
1999 response_.request_time, response_.response_time, Time::Now())) { 1999 response_.headers->GetFreshnessExpiry(response_.request_time,
2000 return true; 2000 response_.response_time);
2001 } 2001 return freshness_expiry <= Time::Now();
2002
2003 return false;
2004 } 2002 }
2005 2003
2006 bool HttpCache::Transaction::ConditionalizeRequest() { 2004 bool HttpCache::Transaction::ConditionalizeRequest() {
2007 DCHECK(response_.headers.get()); 2005 DCHECK(response_.headers.get());
2008 2006
2009 if (request_->method == "PUT" || request_->method == "DELETE") 2007 if (request_->method == "PUT" || request_->method == "DELETE")
2010 return false; 2008 return false;
2011 2009
2012 // This only makes sense for cached 200 or 206 responses. 2010 // This only makes sense for cached 200 or 206 responses.
2013 if (response_.headers->response_code() != 200 && 2011 if (response_.headers->response_code() != 200 &&
(...skipping 503 matching lines...) Expand 10 before | Expand all | Expand 10 after
2517 default: 2515 default:
2518 NOTREACHED(); 2516 NOTREACHED();
2519 } 2517 }
2520 } 2518 }
2521 2519
2522 void HttpCache::Transaction::OnIOComplete(int result) { 2520 void HttpCache::Transaction::OnIOComplete(int result) {
2523 DoLoop(result); 2521 DoLoop(result);
2524 } 2522 }
2525 2523
2526 } // namespace net 2524 } // namespace net
OLDNEW
« no previous file with comments | « no previous file | net/http/http_response_headers.h » ('j') | net/http/http_response_headers.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698