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_network_transaction.h" | 5 #include "net/http/http_network_transaction.h" |
6 | 6 |
7 #include <set> | 7 #include <set> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 969 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
980 // bizarre for SPDY. Assuming this logic is useful at all. | 980 // bizarre for SPDY. Assuming this logic is useful at all. |
981 // TODO(davidben): Bubble the error code up so we do not cache? | 981 // TODO(davidben): Bubble the error code up so we do not cache? |
982 if (result == ERR_CONNECTION_CLOSED && response_.headers.get()) | 982 if (result == ERR_CONNECTION_CLOSED && response_.headers.get()) |
983 result = OK; | 983 result = OK; |
984 | 984 |
985 if (result < 0) | 985 if (result < 0) |
986 return HandleIOError(result); | 986 return HandleIOError(result); |
987 | 987 |
988 DCHECK(response_.headers.get()); | 988 DCHECK(response_.headers.get()); |
989 | 989 |
| 990 // On a 408 response from the server ("Request Timeout") on a stale socket, |
| 991 // retry the request. |
| 992 if (response_.headers->response_code() == 408 && |
| 993 stream_->IsConnectionReused()) { |
| 994 net_log_.AddEventWithNetErrorCode( |
| 995 NetLog::TYPE_HTTP_TRANSACTION_RESTART_AFTER_ERROR, |
| 996 response_.headers->response_code()); |
| 997 // This will close the socket - it would be weird to try and reuse it, even |
| 998 // if the server doesn't actually close it. |
| 999 ResetConnectionAndRequestForResend(); |
| 1000 return OK; |
| 1001 } |
| 1002 |
990 #if defined(SPDY_PROXY_AUTH_ORIGIN) | 1003 #if defined(SPDY_PROXY_AUTH_ORIGIN) |
991 // Server-induced fallback; see: http://crbug.com/143712 | 1004 // Server-induced fallback; see: http://crbug.com/143712 |
992 if (response_.was_fetched_via_proxy) { | 1005 if (response_.was_fetched_via_proxy) { |
993 ProxyService::DataReductionProxyBypassEventType proxy_bypass_event = | 1006 ProxyService::DataReductionProxyBypassEventType proxy_bypass_event = |
994 ProxyService::BYPASS_EVENT_TYPE_MAX; | 1007 ProxyService::BYPASS_EVENT_TYPE_MAX; |
995 bool data_reduction_proxy_used = | 1008 bool data_reduction_proxy_used = |
996 proxy_info_.proxy_server().isDataReductionProxy(); | 1009 proxy_info_.proxy_server().isDataReductionProxy(); |
997 bool data_reduction_fallback_proxy_used = false; | 1010 bool data_reduction_fallback_proxy_used = false; |
998 #if defined(DATA_REDUCTION_FALLBACK_HOST) | 1011 #if defined(DATA_REDUCTION_FALLBACK_HOST) |
999 if (!data_reduction_proxy_used) { | 1012 if (!data_reduction_proxy_used) { |
(...skipping 599 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1599 description = base::StringPrintf("Unknown state 0x%08X (%u)", state, | 1612 description = base::StringPrintf("Unknown state 0x%08X (%u)", state, |
1600 state); | 1613 state); |
1601 break; | 1614 break; |
1602 } | 1615 } |
1603 return description; | 1616 return description; |
1604 } | 1617 } |
1605 | 1618 |
1606 #undef STATE_CASE | 1619 #undef STATE_CASE |
1607 | 1620 |
1608 } // namespace net | 1621 } // namespace net |
OLD | NEW |