| OLD | NEW |
| 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 Loading... |
| 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 response_.response_time); |
| 2001 if (freshness_expiry >= Time::Now()) |
| 2000 return true; | 2002 return true; |
| 2001 } | |
| 2002 | 2003 |
| 2003 return false; | 2004 return false; |
| 2004 } | 2005 } |
| 2005 | 2006 |
| 2006 bool HttpCache::Transaction::ConditionalizeRequest() { | 2007 bool HttpCache::Transaction::ConditionalizeRequest() { |
| 2007 DCHECK(response_.headers.get()); | 2008 DCHECK(response_.headers.get()); |
| 2008 | 2009 |
| 2009 if (request_->method == "PUT" || request_->method == "DELETE") | 2010 if (request_->method == "PUT" || request_->method == "DELETE") |
| 2010 return false; | 2011 return false; |
| 2011 | 2012 |
| (...skipping 505 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2517 default: | 2518 default: |
| 2518 NOTREACHED(); | 2519 NOTREACHED(); |
| 2519 } | 2520 } |
| 2520 } | 2521 } |
| 2521 | 2522 |
| 2522 void HttpCache::Transaction::OnIOComplete(int result) { | 2523 void HttpCache::Transaction::OnIOComplete(int result) { |
| 2523 DoLoop(result); | 2524 DoLoop(result); |
| 2524 } | 2525 } |
| 2525 | 2526 |
| 2526 } // namespace net | 2527 } // namespace net |
| OLD | NEW |