| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 "base/scoped_ptr.h" | 7 #include "base/scoped_ptr.h" |
| 8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
| 9 #include "base/string_util.h" | 9 #include "base/string_util.h" |
| 10 #include "base/trace_event.h" | 10 #include "base/trace_event.h" |
| (...skipping 471 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 482 // If we are using a direct SSL connection, then go ahead and create the SSL | 482 // If we are using a direct SSL connection, then go ahead and create the SSL |
| 483 // wrapper socket now. Otherwise, we need to first issue a CONNECT request. | 483 // wrapper socket now. Otherwise, we need to first issue a CONNECT request. |
| 484 if (using_ssl_ && !using_tunnel_) | 484 if (using_ssl_ && !using_tunnel_) |
| 485 s = socket_factory_->CreateSSLClientSocket(s, request_->url.host()); | 485 s = socket_factory_->CreateSSLClientSocket(s, request_->url.host()); |
| 486 | 486 |
| 487 connection_.set_socket(s); | 487 connection_.set_socket(s); |
| 488 return connection_.socket()->Connect(&io_callback_); | 488 return connection_.socket()->Connect(&io_callback_); |
| 489 } | 489 } |
| 490 | 490 |
| 491 int HttpNetworkTransaction::DoConnectComplete(int result) { | 491 int HttpNetworkTransaction::DoConnectComplete(int result) { |
| 492 if (IsCertificateError(result)) |
| 493 result = HandleCertificateError(result); |
| 494 |
| 492 if (result == OK) { | 495 if (result == OK) { |
| 493 next_state_ = STATE_WRITE_HEADERS; | 496 next_state_ = STATE_WRITE_HEADERS; |
| 494 if (using_tunnel_) | 497 if (using_tunnel_) |
| 495 establishing_tunnel_ = true; | 498 establishing_tunnel_ = true; |
| 496 } else if (IsCertificateError(result)) { | |
| 497 result = HandleCertificateError(result); | |
| 498 } | 499 } |
| 499 return result; | 500 return result; |
| 500 } | 501 } |
| 501 | 502 |
| 502 int HttpNetworkTransaction::DoSSLConnectOverTunnel() { | 503 int HttpNetworkTransaction::DoSSLConnectOverTunnel() { |
| 503 next_state_ = STATE_SSL_CONNECT_OVER_TUNNEL_COMPLETE; | 504 next_state_ = STATE_SSL_CONNECT_OVER_TUNNEL_COMPLETE; |
| 504 | 505 |
| 505 ClientSocket* s = connection_.release_socket(); | 506 ClientSocket* s = connection_.release_socket(); |
| 506 s = socket_factory_->CreateSSLClientSocket(s, request_->url.host()); | 507 s = socket_factory_->CreateSSLClientSocket(s, request_->url.host()); |
| 507 connection_.set_socket(s); | 508 connection_.set_socket(s); |
| 508 return connection_.socket()->Connect(&io_callback_); | 509 return connection_.socket()->Connect(&io_callback_); |
| 509 } | 510 } |
| 510 | 511 |
| 511 int HttpNetworkTransaction::DoSSLConnectOverTunnelComplete(int result) { | 512 int HttpNetworkTransaction::DoSSLConnectOverTunnelComplete(int result) { |
| 512 if (result == OK) { | 513 if (IsCertificateError(result)) |
| 514 result = HandleCertificateError(result); |
| 515 |
| 516 if (result == OK) |
| 513 next_state_ = STATE_WRITE_HEADERS; | 517 next_state_ = STATE_WRITE_HEADERS; |
| 514 } else if (IsCertificateError(result)) { | |
| 515 result = HandleCertificateError(result); | |
| 516 } | |
| 517 return result; | 518 return result; |
| 518 } | 519 } |
| 519 | 520 |
| 520 int HttpNetworkTransaction::DoWriteHeaders() { | 521 int HttpNetworkTransaction::DoWriteHeaders() { |
| 521 next_state_ = STATE_WRITE_HEADERS_COMPLETE; | 522 next_state_ = STATE_WRITE_HEADERS_COMPLETE; |
| 522 | 523 |
| 523 // This is constructed lazily (instead of within our Start method), so that | 524 // This is constructed lazily (instead of within our Start method), so that |
| 524 // we have proxy info available. | 525 // we have proxy info available. |
| 525 if (request_headers_.empty()) { | 526 if (request_headers_.empty()) { |
| 526 if (establishing_tunnel_) { | 527 if (establishing_tunnel_) { |
| (...skipping 480 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1007 auth_data_[target]->state = AUTH_STATE_NEED_AUTH; | 1008 auth_data_[target]->state = AUTH_STATE_NEED_AUTH; |
| 1008 } | 1009 } |
| 1009 | 1010 |
| 1010 response_.auth_challenge.swap(auth_info); | 1011 response_.auth_challenge.swap(auth_info); |
| 1011 auth_handler_[target].reset(auth_handler.release()); | 1012 auth_handler_[target].reset(auth_handler.release()); |
| 1012 | 1013 |
| 1013 return OK; | 1014 return OK; |
| 1014 } | 1015 } |
| 1015 | 1016 |
| 1016 } // namespace net | 1017 } // namespace net |
| OLD | NEW |