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 2101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2112 return OK; | 2112 return OK; |
2113 } | 2113 } |
2114 | 2114 |
2115 int HttpCache::Transaction::BeginCacheValidation() { | 2115 int HttpCache::Transaction::BeginCacheValidation() { |
2116 DCHECK(mode_ == READ_WRITE); | 2116 DCHECK(mode_ == READ_WRITE); |
2117 | 2117 |
2118 ValidationType required_validation = RequiresValidation(); | 2118 ValidationType required_validation = RequiresValidation(); |
2119 | 2119 |
2120 bool skip_validation = (required_validation == VALIDATION_NONE); | 2120 bool skip_validation = (required_validation == VALIDATION_NONE); |
2121 | 2121 |
2122 if ((effective_load_flags_ & LOAD_SUPPORT_ASYNC_REVALIDATION) && | |
2123 required_validation == VALIDATION_ASYNCHRONOUS) { | |
2124 DCHECK(request_->method == "HEAD" || request_->method == "GET"); | |
hiroshige
2015/06/12 05:58:03
The doc says: "Only the GET method is in scope." a
Adam Rice
2015/06/12 06:41:57
You're right. Fixed.
| |
2125 skip_validation = true; | |
2126 response_.async_revalidation_required = true; | |
2127 } | |
2128 | |
2122 if (request_->method == "HEAD" && | 2129 if (request_->method == "HEAD" && |
2123 (truncated_ || response_.headers->response_code() == 206)) { | 2130 (truncated_ || response_.headers->response_code() == 206)) { |
2124 DCHECK(!partial_); | 2131 DCHECK(!partial_); |
2125 if (skip_validation) | 2132 if (skip_validation) |
2126 return SetupEntryForRead(); | 2133 return SetupEntryForRead(); |
2127 | 2134 |
2128 // Bail out! | 2135 // Bail out! |
2129 next_state_ = STATE_SEND_REQUEST; | 2136 next_state_ = STATE_SEND_REQUEST; |
2130 mode_ = NONE; | 2137 mode_ = NONE; |
2131 return OK; | 2138 return OK; |
(...skipping 806 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2938 default: | 2945 default: |
2939 NOTREACHED(); | 2946 NOTREACHED(); |
2940 } | 2947 } |
2941 } | 2948 } |
2942 | 2949 |
2943 void HttpCache::Transaction::OnIOComplete(int result) { | 2950 void HttpCache::Transaction::OnIOComplete(int result) { |
2944 DoLoop(result); | 2951 DoLoop(result); |
2945 } | 2952 } |
2946 | 2953 |
2947 } // namespace net | 2954 } // namespace net |
OLD | NEW |