Chromium Code Reviews| 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/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/bind.h" | 8 #include "base/bind.h" |
| 9 #include "base/bind_helpers.h" | 9 #include "base/bind_helpers.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 24 matching lines...) Expand all Loading... | |
| 35 #include "net/http/http_request_headers.h" | 35 #include "net/http/http_request_headers.h" |
| 36 #include "net/http/http_response_headers.h" | 36 #include "net/http/http_response_headers.h" |
| 37 #include "net/http/http_response_info.h" | 37 #include "net/http/http_response_info.h" |
| 38 #include "net/http/http_status_code.h" | 38 #include "net/http/http_status_code.h" |
| 39 #include "net/http/http_transaction.h" | 39 #include "net/http/http_transaction.h" |
| 40 #include "net/http/http_transaction_factory.h" | 40 #include "net/http/http_transaction_factory.h" |
| 41 #include "net/http/http_util.h" | 41 #include "net/http/http_util.h" |
| 42 #include "net/proxy/proxy_info.h" | 42 #include "net/proxy/proxy_info.h" |
| 43 #include "net/ssl/ssl_cert_request_info.h" | 43 #include "net/ssl/ssl_cert_request_info.h" |
| 44 #include "net/ssl/ssl_config_service.h" | 44 #include "net/ssl/ssl_config_service.h" |
| 45 #include "net/ssl/ssl_private_key.h" | |
|
davidben
2015/09/25 20:10:12
Nit: unnecessary
svaldez
2015/09/28 16:54:53
Done.
| |
| 45 #include "net/url_request/http_user_agent_settings.h" | 46 #include "net/url_request/http_user_agent_settings.h" |
| 46 #include "net/url_request/url_request.h" | 47 #include "net/url_request/url_request.h" |
| 47 #include "net/url_request/url_request_backoff_manager.h" | 48 #include "net/url_request/url_request_backoff_manager.h" |
| 48 #include "net/url_request/url_request_context.h" | 49 #include "net/url_request/url_request_context.h" |
| 49 #include "net/url_request/url_request_error_job.h" | 50 #include "net/url_request/url_request_error_job.h" |
| 50 #include "net/url_request/url_request_job_factory.h" | 51 #include "net/url_request/url_request_job_factory.h" |
| 51 #include "net/url_request/url_request_redirect_job.h" | 52 #include "net/url_request/url_request_redirect_job.h" |
| 52 #include "net/url_request/url_request_throttler_manager.h" | 53 #include "net/url_request/url_request_throttler_manager.h" |
| 53 #include "net/websockets/websocket_handshake_stream_base.h" | 54 #include "net/websockets/websocket_handshake_stream_base.h" |
| 54 | 55 |
| (...skipping 1183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1238 // which will cause the consumer to receive OnResponseStarted instead of | 1239 // which will cause the consumer to receive OnResponseStarted instead of |
| 1239 // OnAuthRequired. | 1240 // OnAuthRequired. |
| 1240 // | 1241 // |
| 1241 // We have to do this via InvokeLater to avoid "recursing" the consumer. | 1242 // We have to do this via InvokeLater to avoid "recursing" the consumer. |
| 1242 // | 1243 // |
| 1243 base::ThreadTaskRunnerHandle::Get()->PostTask( | 1244 base::ThreadTaskRunnerHandle::Get()->PostTask( |
| 1244 FROM_HERE, base::Bind(&URLRequestHttpJob::OnStartCompleted, | 1245 FROM_HERE, base::Bind(&URLRequestHttpJob::OnStartCompleted, |
| 1245 weak_factory_.GetWeakPtr(), OK)); | 1246 weak_factory_.GetWeakPtr(), OK)); |
| 1246 } | 1247 } |
| 1247 | 1248 |
| 1248 void URLRequestHttpJob::ContinueWithCertificate( | 1249 void URLRequestHttpJob::ContinueWithCertificate(X509Certificate* client_cert, |
| 1249 X509Certificate* client_cert) { | 1250 SSLPrivateKey* client_pkey) { |
| 1250 DCHECK(transaction_.get()); | 1251 DCHECK(transaction_.get()); |
| 1251 | 1252 |
| 1252 DCHECK(!response_info_) << "should not have a response yet"; | 1253 DCHECK(!response_info_) << "should not have a response yet"; |
| 1253 receive_headers_end_ = base::TimeTicks(); | 1254 receive_headers_end_ = base::TimeTicks(); |
| 1254 | 1255 |
| 1255 ResetTimer(); | 1256 ResetTimer(); |
| 1256 | 1257 |
| 1257 // No matter what, we want to report our status as IO pending since we will | 1258 // No matter what, we want to report our status as IO pending since we will |
| 1258 // be notifying our consumer asynchronously via OnStartCompleted. | 1259 // be notifying our consumer asynchronously via OnStartCompleted. |
| 1259 SetStatus(URLRequestStatus(URLRequestStatus::IO_PENDING, 0)); | 1260 SetStatus(URLRequestStatus(URLRequestStatus::IO_PENDING, 0)); |
| 1260 | 1261 |
| 1261 int rv = transaction_->RestartWithCertificate(client_cert, start_callback_); | 1262 int rv = transaction_->RestartWithCertificate(client_cert, client_pkey, |
| 1263 start_callback_); | |
| 1262 if (rv == ERR_IO_PENDING) | 1264 if (rv == ERR_IO_PENDING) |
| 1263 return; | 1265 return; |
| 1264 | 1266 |
| 1265 // The transaction started synchronously, but we need to notify the | 1267 // The transaction started synchronously, but we need to notify the |
| 1266 // URLRequest delegate via the message loop. | 1268 // URLRequest delegate via the message loop. |
| 1267 base::ThreadTaskRunnerHandle::Get()->PostTask( | 1269 base::ThreadTaskRunnerHandle::Get()->PostTask( |
| 1268 FROM_HERE, base::Bind(&URLRequestHttpJob::OnStartCompleted, | 1270 FROM_HERE, base::Bind(&URLRequestHttpJob::OnStartCompleted, |
| 1269 weak_factory_.GetWeakPtr(), rv)); | 1271 weak_factory_.GetWeakPtr(), rv)); |
| 1270 } | 1272 } |
| 1271 | 1273 |
| (...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1567 return override_response_headers_.get() ? | 1569 return override_response_headers_.get() ? |
| 1568 override_response_headers_.get() : | 1570 override_response_headers_.get() : |
| 1569 transaction_->GetResponseInfo()->headers.get(); | 1571 transaction_->GetResponseInfo()->headers.get(); |
| 1570 } | 1572 } |
| 1571 | 1573 |
| 1572 void URLRequestHttpJob::NotifyURLRequestDestroyed() { | 1574 void URLRequestHttpJob::NotifyURLRequestDestroyed() { |
| 1573 awaiting_callback_ = false; | 1575 awaiting_callback_ = false; |
| 1574 } | 1576 } |
| 1575 | 1577 |
| 1576 } // namespace net | 1578 } // namespace net |
| OLD | NEW |