| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/url_request/url_request_http_job.h" | 5 #include "net/url_request/url_request_http_job.h" |
| 6 | 6 |
| 7 #include "base/base_switches.h" | 7 #include "base/base_switches.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
| 10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
| 11 #include "base/file_version_info.h" | 11 #include "base/file_version_info.h" |
| 12 #include "base/message_loop.h" | 12 #include "base/message_loop.h" |
| 13 #include "base/rand_util.h" | 13 #include "base/rand_util.h" |
| 14 #include "base/string_util.h" | 14 #include "base/string_util.h" |
| 15 #include "net/base/cert_status_flags.h" | 15 #include "net/base/cert_status_flags.h" |
| 16 #include "net/base/cookie_policy.h" | 16 #include "net/base/cookie_policy.h" |
| 17 #include "net/base/cookie_store.h" | 17 #include "net/base/cookie_store.h" |
| 18 #include "net/base/filter.h" | 18 #include "net/base/filter.h" |
| 19 #include "net/base/transport_security_state.h" | 19 #include "net/base/host_port_pair.h" |
| 20 #include "net/base/load_flags.h" | 20 #include "net/base/load_flags.h" |
| 21 #include "net/base/net_errors.h" | 21 #include "net/base/net_errors.h" |
| 22 #include "net/base/net_util.h" | 22 #include "net/base/net_util.h" |
| 23 #include "net/base/sdch_manager.h" | 23 #include "net/base/sdch_manager.h" |
| 24 #include "net/base/ssl_cert_request_info.h" | 24 #include "net/base/ssl_cert_request_info.h" |
| 25 #include "net/base/transport_security_state.h" |
| 25 #include "net/http/http_request_headers.h" | 26 #include "net/http/http_request_headers.h" |
| 26 #include "net/http/http_response_headers.h" | 27 #include "net/http/http_response_headers.h" |
| 27 #include "net/http/http_response_info.h" | 28 #include "net/http/http_response_info.h" |
| 28 #include "net/http/http_transaction.h" | 29 #include "net/http/http_transaction.h" |
| 29 #include "net/http/http_transaction_factory.h" | 30 #include "net/http/http_transaction_factory.h" |
| 30 #include "net/http/http_util.h" | 31 #include "net/http/http_util.h" |
| 31 #include "net/url_request/https_prober.h" | 32 #include "net/url_request/https_prober.h" |
| 32 #include "net/url_request/url_request.h" | 33 #include "net/url_request/url_request.h" |
| 33 #include "net/url_request/url_request_context.h" | 34 #include "net/url_request/url_request_context.h" |
| 34 #include "net/url_request/url_request_error_job.h" | 35 #include "net/url_request/url_request_error_job.h" |
| (...skipping 884 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 919 } | 920 } |
| 920 | 921 |
| 921 return false; | 922 return false; |
| 922 } | 923 } |
| 923 | 924 |
| 924 void URLRequestHttpJob::StopCaching() { | 925 void URLRequestHttpJob::StopCaching() { |
| 925 if (transaction_.get()) | 926 if (transaction_.get()) |
| 926 transaction_->StopCaching(); | 927 transaction_->StopCaching(); |
| 927 } | 928 } |
| 928 | 929 |
| 930 HostPortPair URLRequestHttpJob::GetSocketAddress() const { |
| 931 return response_info_ ? response_info_->socket_address : HostPortPair(); |
| 932 } |
| 933 |
| 929 URLRequestHttpJob::~URLRequestHttpJob() { | 934 URLRequestHttpJob::~URLRequestHttpJob() { |
| 930 DCHECK(!sdch_test_control_ || !sdch_test_activated_); | 935 DCHECK(!sdch_test_control_ || !sdch_test_activated_); |
| 931 if (!IsCachedContent()) { | 936 if (!IsCachedContent()) { |
| 932 if (sdch_test_control_) | 937 if (sdch_test_control_) |
| 933 RecordPacketStats(SDCH_EXPERIMENT_HOLDBACK); | 938 RecordPacketStats(SDCH_EXPERIMENT_HOLDBACK); |
| 934 if (sdch_test_activated_) | 939 if (sdch_test_activated_) |
| 935 RecordPacketStats(SDCH_EXPERIMENT_DECODE); | 940 RecordPacketStats(SDCH_EXPERIMENT_DECODE); |
| 936 } | 941 } |
| 937 // Make sure SDCH filters are told to emit histogram data while this class | 942 // Make sure SDCH filters are told to emit histogram data while this class |
| 938 // can still service the IsCachedContent() call. | 943 // can still service the IsCachedContent() call. |
| 939 DestroyFilters(); | 944 DestroyFilters(); |
| 940 | 945 |
| 941 if (sdch_dictionary_url_.is_valid()) { | 946 if (sdch_dictionary_url_.is_valid()) { |
| 942 // Prior to reaching the destructor, request_ has been set to a NULL | 947 // Prior to reaching the destructor, request_ has been set to a NULL |
| 943 // pointer, so request_->url() is no longer valid in the destructor, and we | 948 // pointer, so request_->url() is no longer valid in the destructor, and we |
| 944 // use an alternate copy |request_info_.url|. | 949 // use an alternate copy |request_info_.url|. |
| 945 SdchManager* manager = SdchManager::Global(); | 950 SdchManager* manager = SdchManager::Global(); |
| 946 // To be extra safe, since this is a "different time" from when we decided | 951 // To be extra safe, since this is a "different time" from when we decided |
| 947 // to get the dictionary, we'll validate that an SdchManager is available. | 952 // to get the dictionary, we'll validate that an SdchManager is available. |
| 948 // At shutdown time, care is taken to be sure that we don't delete this | 953 // At shutdown time, care is taken to be sure that we don't delete this |
| 949 // globally useful instance "too soon," so this check is just defensive | 954 // globally useful instance "too soon," so this check is just defensive |
| 950 // coding to assure that IF the system is shutting down, we don't have any | 955 // coding to assure that IF the system is shutting down, we don't have any |
| 951 // problem if the manager was deleted ahead of time. | 956 // problem if the manager was deleted ahead of time. |
| 952 if (manager) // Defensive programming. | 957 if (manager) // Defensive programming. |
| 953 manager->FetchDictionary(request_info_.url, sdch_dictionary_url_); | 958 manager->FetchDictionary(request_info_.url, sdch_dictionary_url_); |
| 954 } | 959 } |
| 955 } | 960 } |
| 956 | 961 |
| 957 } // namespace net | 962 } // namespace net |
| OLD | NEW |