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 28 matching lines...) Expand all Loading... |
39 #include "net/http/http_network_session.h" | 39 #include "net/http/http_network_session.h" |
40 #include "net/http/http_proxy_client_socket.h" | 40 #include "net/http/http_proxy_client_socket.h" |
41 #include "net/http/http_proxy_client_socket_pool.h" | 41 #include "net/http/http_proxy_client_socket_pool.h" |
42 #include "net/http/http_request_headers.h" | 42 #include "net/http/http_request_headers.h" |
43 #include "net/http/http_request_info.h" | 43 #include "net/http/http_request_info.h" |
44 #include "net/http/http_response_headers.h" | 44 #include "net/http/http_response_headers.h" |
45 #include "net/http/http_response_info.h" | 45 #include "net/http/http_response_info.h" |
46 #include "net/http/http_server_properties.h" | 46 #include "net/http/http_server_properties.h" |
47 #include "net/http/http_status_code.h" | 47 #include "net/http/http_status_code.h" |
48 #include "net/http/http_stream_factory.h" | 48 #include "net/http/http_stream_factory.h" |
| 49 #include "net/http/http_transaction_delegate.h" |
49 #include "net/http/http_util.h" | 50 #include "net/http/http_util.h" |
50 #include "net/http/url_security_manager.h" | 51 #include "net/http/url_security_manager.h" |
51 #include "net/socket/client_socket_factory.h" | 52 #include "net/socket/client_socket_factory.h" |
52 #include "net/socket/socks_client_socket_pool.h" | 53 #include "net/socket/socks_client_socket_pool.h" |
53 #include "net/socket/ssl_client_socket.h" | 54 #include "net/socket/ssl_client_socket.h" |
54 #include "net/socket/ssl_client_socket_pool.h" | 55 #include "net/socket/ssl_client_socket_pool.h" |
55 #include "net/socket/transport_client_socket_pool.h" | 56 #include "net/socket/transport_client_socket_pool.h" |
56 #include "net/spdy/spdy_http_stream.h" | 57 #include "net/spdy/spdy_http_stream.h" |
57 #include "net/spdy/spdy_session.h" | 58 #include "net/spdy/spdy_session.h" |
58 #include "net/spdy/spdy_session_pool.h" | 59 #include "net/spdy/spdy_session_pool.h" |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 ALLOW_THIS_IN_INITIALIZER_LIST(io_callback_( | 116 ALLOW_THIS_IN_INITIALIZER_LIST(io_callback_( |
116 base::Bind(&HttpNetworkTransaction::OnIOComplete, | 117 base::Bind(&HttpNetworkTransaction::OnIOComplete, |
117 base::Unretained(this)))), | 118 base::Unretained(this)))), |
118 session_(session), | 119 session_(session), |
119 request_(NULL), | 120 request_(NULL), |
120 headers_valid_(false), | 121 headers_valid_(false), |
121 logged_response_time_(false), | 122 logged_response_time_(false), |
122 request_headers_(), | 123 request_headers_(), |
123 read_buf_len_(0), | 124 read_buf_len_(0), |
124 next_state_(STATE_NONE), | 125 next_state_(STATE_NONE), |
125 establishing_tunnel_(false) { | 126 establishing_tunnel_(false), |
| 127 delegate_(NULL) { |
126 session->ssl_config_service()->GetSSLConfig(&server_ssl_config_); | 128 session->ssl_config_service()->GetSSLConfig(&server_ssl_config_); |
127 if (session->http_stream_factory()->has_next_protos()) { | 129 if (session->http_stream_factory()->has_next_protos()) { |
128 server_ssl_config_.next_protos = | 130 server_ssl_config_.next_protos = |
129 session->http_stream_factory()->next_protos(); | 131 session->http_stream_factory()->next_protos(); |
130 } | 132 } |
131 proxy_ssl_config_ = server_ssl_config_; | 133 proxy_ssl_config_ = server_ssl_config_; |
132 } | 134 } |
133 | 135 |
134 HttpNetworkTransaction::~HttpNetworkTransaction() { | 136 HttpNetworkTransaction::~HttpNetworkTransaction() { |
135 if (stream_.get()) { | 137 if (stream_.get()) { |
(...skipping 605 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
741 | 743 |
742 request_headers_.MergeFrom(request_->extra_headers); | 744 request_headers_.MergeFrom(request_->extra_headers); |
743 } | 745 } |
744 | 746 |
745 int HttpNetworkTransaction::DoBuildRequest() { | 747 int HttpNetworkTransaction::DoBuildRequest() { |
746 next_state_ = STATE_BUILD_REQUEST_COMPLETE; | 748 next_state_ = STATE_BUILD_REQUEST_COMPLETE; |
747 request_body_.reset(NULL); | 749 request_body_.reset(NULL); |
748 if (request_->upload_data) { | 750 if (request_->upload_data) { |
749 request_body_.reset(new UploadDataStream(request_->upload_data)); | 751 request_body_.reset(new UploadDataStream(request_->upload_data)); |
750 const int error_code = request_body_->Init(); | 752 const int error_code = request_body_->Init(); |
751 if (error_code != OK) { | 753 if (error_code == OK) { |
| 754 if (delegate_) |
| 755 delegate_->OnRequestBodyInitialized(request_body_->size()); |
| 756 } else { |
752 request_body_.reset(NULL); | 757 request_body_.reset(NULL); |
753 return error_code; | 758 return error_code; |
754 } | 759 } |
755 } | 760 } |
756 | 761 |
757 headers_valid_ = false; | 762 headers_valid_ = false; |
758 | 763 |
759 // This is constructed lazily (instead of within our Start method), so that | 764 // This is constructed lazily (instead of within our Start method), so that |
760 // we have proxy info available. | 765 // we have proxy info available. |
761 if (request_headers_.IsEmpty()) { | 766 if (request_headers_.IsEmpty()) { |
(...skipping 652 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1414 description = base::StringPrintf("Unknown state 0x%08X (%u)", state, | 1419 description = base::StringPrintf("Unknown state 0x%08X (%u)", state, |
1415 state); | 1420 state); |
1416 break; | 1421 break; |
1417 } | 1422 } |
1418 return description; | 1423 return description; |
1419 } | 1424 } |
1420 | 1425 |
1421 #undef STATE_CASE | 1426 #undef STATE_CASE |
1422 | 1427 |
1423 } // namespace net | 1428 } // namespace net |
OLD | NEW |