| OLD | NEW |
| 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.h" | 5 #include "net/http/http_cache.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| (...skipping 1196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1207 // end up forwarding the 200 back to the user (so far so good). However, if | 1207 // end up forwarding the 200 back to the user (so far so good). However, if |
| 1208 // we have instead the first 10KB, we end up sending back a byte range response | 1208 // we have instead the first 10KB, we end up sending back a byte range response |
| 1209 // for the first 10KB, because we never asked the server for the last part. It's | 1209 // for the first 10KB, because we never asked the server for the last part. It's |
| 1210 // just too complicated to restart the whole request from this point; and of | 1210 // just too complicated to restart the whole request from this point; and of |
| 1211 // course, maybe we already returned the headers. | 1211 // course, maybe we already returned the headers. |
| 1212 bool HttpCache::Transaction::ValidatePartialResponse( | 1212 bool HttpCache::Transaction::ValidatePartialResponse( |
| 1213 const HttpResponseHeaders* headers) { | 1213 const HttpResponseHeaders* headers) { |
| 1214 int response_code = headers->response_code(); | 1214 int response_code = headers->response_code(); |
| 1215 bool partial_content = enable_range_support_ ? response_code == 206 : false; | 1215 bool partial_content = enable_range_support_ ? response_code == 206 : false; |
| 1216 | 1216 |
| 1217 if (!entry_) |
| 1218 return false; |
| 1219 |
| 1217 if (invalid_range_) { | 1220 if (invalid_range_) { |
| 1218 // We gave up trying to match this request with the stored data. If the | 1221 // We gave up trying to match this request with the stored data. If the |
| 1219 // server is ok with the request, delete the entry, otherwise just ignore | 1222 // server is ok with the request, delete the entry, otherwise just ignore |
| 1220 // this request | 1223 // this request |
| 1221 if (partial_content || response_code == 200 || response_code == 304) { | 1224 if (partial_content || response_code == 200 || response_code == 304) { |
| 1222 DoomPartialEntry(true); | 1225 DoomPartialEntry(true); |
| 1223 mode_ = NONE; | 1226 mode_ = NONE; |
| 1224 } else { | 1227 } else { |
| 1225 IgnoreRangeRequest(); | 1228 IgnoreRangeRequest(); |
| 1226 } | 1229 } |
| (...skipping 884 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2111 static_cast<net::HttpNetworkLayer*>(network_layer_.get()); | 2114 static_cast<net::HttpNetworkLayer*>(network_layer_.get()); |
| 2112 HttpNetworkSession* session = network->GetSession(); | 2115 HttpNetworkSession* session = network->GetSession(); |
| 2113 if (session) { | 2116 if (session) { |
| 2114 session->tcp_socket_pool()->CloseIdleSockets(); | 2117 session->tcp_socket_pool()->CloseIdleSockets(); |
| 2115 } | 2118 } |
| 2116 } | 2119 } |
| 2117 | 2120 |
| 2118 //----------------------------------------------------------------------------- | 2121 //----------------------------------------------------------------------------- |
| 2119 | 2122 |
| 2120 } // namespace net | 2123 } // namespace net |
| OLD | NEW |