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" // For OS_POSIX | 7 #include "build/build_config.h" // For OS_POSIX |
8 | 8 |
9 #if defined(OS_POSIX) | 9 #if defined(OS_POSIX) |
10 #include <unistd.h> | 10 #include <unistd.h> |
(...skipping 2340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2351 | 2351 |
2352 if (request_->method == "PUT" || request_->method == "DELETE") | 2352 if (request_->method == "PUT" || request_->method == "DELETE") |
2353 return VALIDATION_SYNCHRONOUS; | 2353 return VALIDATION_SYNCHRONOUS; |
2354 | 2354 |
2355 ValidationType validation_required_by_headers = | 2355 ValidationType validation_required_by_headers = |
2356 response_.headers->RequiresValidation(response_.request_time, | 2356 response_.headers->RequiresValidation(response_.request_time, |
2357 response_.response_time, | 2357 response_.response_time, |
2358 cache_->clock_->Now()); | 2358 cache_->clock_->Now()); |
2359 | 2359 |
2360 if (validation_required_by_headers == VALIDATION_ASYNCHRONOUS) { | 2360 if (validation_required_by_headers == VALIDATION_ASYNCHRONOUS) { |
2361 // Asynchronous revalidation is only supported for GET and HEAD methods. | 2361 // Asynchronous revalidation is only supported for GET methods. |
2362 if (request_->method != "GET" && request_->method != "HEAD") | 2362 if (request_->method != "GET") |
2363 return VALIDATION_SYNCHRONOUS; | 2363 return VALIDATION_SYNCHRONOUS; |
2364 } | 2364 } |
2365 | 2365 |
2366 return validation_required_by_headers; | 2366 return validation_required_by_headers; |
2367 } | 2367 } |
2368 | 2368 |
2369 bool HttpCache::Transaction::ConditionalizeRequest() { | 2369 bool HttpCache::Transaction::ConditionalizeRequest() { |
2370 DCHECK(response_.headers.get()); | 2370 DCHECK(response_.headers.get()); |
2371 | 2371 |
2372 if (request_->method == "PUT" || request_->method == "DELETE") | 2372 if (request_->method == "PUT" || request_->method == "DELETE") |
(...skipping 576 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2949 default: | 2949 default: |
2950 NOTREACHED(); | 2950 NOTREACHED(); |
2951 } | 2951 } |
2952 } | 2952 } |
2953 | 2953 |
2954 void HttpCache::Transaction::OnIOComplete(int result) { | 2954 void HttpCache::Transaction::OnIOComplete(int result) { |
2955 DoLoop(result); | 2955 DoLoop(result); |
2956 } | 2956 } |
2957 | 2957 |
2958 } // namespace net | 2958 } // namespace net |
OLD | NEW |