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/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/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
(...skipping 1034 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1045 if (net_log_.HasListener()) { | 1045 if (net_log_.HasListener()) { |
1046 net_log_.AddEvent( | 1046 net_log_.AddEvent( |
1047 NetLog::TYPE_HTTP_TRANSACTION_SEND_REQUEST_HEADERS, | 1047 NetLog::TYPE_HTTP_TRANSACTION_SEND_REQUEST_HEADERS, |
1048 new NetLogHttpRequestParameter(request_line, request_headers)); | 1048 new NetLogHttpRequestParameter(request_line, request_headers)); |
1049 } | 1049 } |
1050 | 1050 |
1051 request_headers_ = request_line + request_headers.ToString(); | 1051 request_headers_ = request_line + request_headers.ToString(); |
1052 } | 1052 } |
1053 | 1053 |
1054 headers_valid_ = false; | 1054 headers_valid_ = false; |
1055 http_stream_.reset(new HttpBasicStream(connection_.get(), net_log_)); | 1055 http_stream_.reset(new HttpBasicStream(connection_.get())); |
1056 | 1056 http_stream_->InitializeStream(request_, net_log_, NULL); |
1057 return http_stream_->SendRequest(request_, request_headers_, | 1057 return http_stream_->SendRequest(request_headers_, request_body, &response_, |
1058 request_body, &response_, &io_callback_); | 1058 &io_callback_); |
1059 } | 1059 } |
1060 | 1060 |
1061 int HttpNetworkTransaction::DoSendRequestComplete(int result) { | 1061 int HttpNetworkTransaction::DoSendRequestComplete(int result) { |
1062 if (result < 0) | 1062 if (result < 0) |
1063 return HandleIOError(result); | 1063 return HandleIOError(result); |
1064 next_state_ = STATE_READ_HEADERS; | 1064 next_state_ = STATE_READ_HEADERS; |
1065 return OK; | 1065 return OK; |
1066 } | 1066 } |
1067 | 1067 |
1068 int HttpNetworkTransaction::DoReadHeaders() { | 1068 int HttpNetworkTransaction::DoReadHeaders() { |
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1290 return error; | 1290 return error; |
1291 } | 1291 } |
1292 } | 1292 } |
1293 | 1293 |
1294 CHECK(spdy_session.get()); | 1294 CHECK(spdy_session.get()); |
1295 if (spdy_session->IsClosed()) | 1295 if (spdy_session->IsClosed()) |
1296 return ERR_CONNECTION_CLOSED; | 1296 return ERR_CONNECTION_CLOSED; |
1297 | 1297 |
1298 headers_valid_ = false; | 1298 headers_valid_ = false; |
1299 | 1299 |
1300 spdy_http_stream_.reset(new SpdyHttpStream()); | 1300 spdy_http_stream_.reset(new SpdyHttpStream(spdy_session)); |
1301 return spdy_http_stream_->InitializeStream(spdy_session, *request_, | 1301 return spdy_http_stream_->InitializeStream(request_, net_log_, &io_callback_); |
1302 net_log_, &io_callback_); | |
1303 } | 1302 } |
1304 | 1303 |
1305 int HttpNetworkTransaction::DoSpdyGetStreamComplete(int result) { | 1304 int HttpNetworkTransaction::DoSpdyGetStreamComplete(int result) { |
1306 if (result < 0) | 1305 if (result < 0) |
1307 return result; | 1306 return result; |
1308 | 1307 |
1309 next_state_ = STATE_SPDY_SEND_REQUEST; | 1308 next_state_ = STATE_SPDY_SEND_REQUEST; |
1310 return OK; | 1309 return OK; |
1311 } | 1310 } |
1312 | 1311 |
1313 int HttpNetworkTransaction::DoSpdySendRequest() { | 1312 int HttpNetworkTransaction::DoSpdySendRequest() { |
1314 next_state_ = STATE_SPDY_SEND_REQUEST_COMPLETE; | 1313 next_state_ = STATE_SPDY_SEND_REQUEST_COMPLETE; |
1315 | 1314 |
1316 UploadDataStream* upload_data_stream = NULL; | 1315 UploadDataStream* upload_data_stream = NULL; |
1317 if (request_->upload_data) { | 1316 if (request_->upload_data) { |
1318 int error_code = OK; | 1317 int error_code = OK; |
1319 upload_data_stream = UploadDataStream::Create(request_->upload_data, | 1318 upload_data_stream = UploadDataStream::Create(request_->upload_data, |
1320 &error_code); | 1319 &error_code); |
1321 if (!upload_data_stream) | 1320 if (!upload_data_stream) |
1322 return error_code; | 1321 return error_code; |
1323 } | 1322 } |
1324 spdy_http_stream_->InitializeRequest(base::Time::Now(), upload_data_stream); | 1323 return spdy_http_stream_->SendRequest(request_headers_, upload_data_stream, |
1325 | 1324 &response_, &io_callback_); |
1326 return spdy_http_stream_->SendRequest(&response_, &io_callback_); | |
1327 } | 1325 } |
1328 | 1326 |
1329 int HttpNetworkTransaction::DoSpdySendRequestComplete(int result) { | 1327 int HttpNetworkTransaction::DoSpdySendRequestComplete(int result) { |
1330 if (result < 0) | 1328 if (result < 0) |
1331 return result; | 1329 return result; |
1332 | 1330 |
1333 next_state_ = STATE_SPDY_READ_HEADERS; | 1331 next_state_ = STATE_SPDY_READ_HEADERS; |
1334 return OK; | 1332 return OK; |
1335 } | 1333 } |
1336 | 1334 |
(...skipping 488 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1825 default: | 1823 default: |
1826 description = StringPrintf("Unknown state 0x%08X (%u)", state, state); | 1824 description = StringPrintf("Unknown state 0x%08X (%u)", state, state); |
1827 break; | 1825 break; |
1828 } | 1826 } |
1829 return description; | 1827 return description; |
1830 } | 1828 } |
1831 | 1829 |
1832 #undef STATE_CASE | 1830 #undef STATE_CASE |
1833 | 1831 |
1834 } // namespace net | 1832 } // namespace net |
OLD | NEW |