| 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/field_trial.h" | 9 #include "base/field_trial.h" |
| 10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
| (...skipping 652 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 663 return connection_.socket()->Write(buf, buf_len, &io_callback_); | 663 return connection_.socket()->Write(buf, buf_len, &io_callback_); |
| 664 } | 664 } |
| 665 | 665 |
| 666 int HttpNetworkTransaction::DoWriteHeadersComplete(int result) { | 666 int HttpNetworkTransaction::DoWriteHeadersComplete(int result) { |
| 667 if (result < 0) | 667 if (result < 0) |
| 668 return HandleIOError(result); | 668 return HandleIOError(result); |
| 669 | 669 |
| 670 request_headers_bytes_sent_ += result; | 670 request_headers_bytes_sent_ += result; |
| 671 if (request_headers_bytes_sent_ < request_headers_.size()) { | 671 if (request_headers_bytes_sent_ < request_headers_.size()) { |
| 672 next_state_ = STATE_WRITE_HEADERS; | 672 next_state_ = STATE_WRITE_HEADERS; |
| 673 } else if (!establishing_tunnel_ && request_->upload_data) { | 673 } else if (!establishing_tunnel_ && request_body_stream_.get() && |
| 674 request_body_stream_->size()) { |
| 674 next_state_ = STATE_WRITE_BODY; | 675 next_state_ = STATE_WRITE_BODY; |
| 675 } else { | 676 } else { |
| 676 next_state_ = STATE_READ_HEADERS; | 677 next_state_ = STATE_READ_HEADERS; |
| 677 } | 678 } |
| 678 return OK; | 679 return OK; |
| 679 } | 680 } |
| 680 | 681 |
| 681 int HttpNetworkTransaction::DoWriteBody() { | 682 int HttpNetworkTransaction::DoWriteBody() { |
| 682 next_state_ = STATE_WRITE_BODY_COMPLETE; | 683 next_state_ = STATE_WRITE_BODY_COMPLETE; |
| 683 | 684 |
| 684 DCHECK(request_->upload_data); | |
| 685 DCHECK(request_body_stream_.get()); | 685 DCHECK(request_body_stream_.get()); |
| 686 DCHECK(request_body_stream_->size()); |
| 686 | 687 |
| 687 const char* buf = request_body_stream_->buf(); | 688 const char* buf = request_body_stream_->buf(); |
| 688 int buf_len = static_cast<int>(request_body_stream_->buf_len()); | 689 int buf_len = static_cast<int>(request_body_stream_->buf_len()); |
| 689 | 690 |
| 690 return connection_.socket()->Write(buf, buf_len, &io_callback_); | 691 return connection_.socket()->Write(buf, buf_len, &io_callback_); |
| 691 } | 692 } |
| 692 | 693 |
| 693 int HttpNetworkTransaction::DoWriteBodyComplete(int result) { | 694 int HttpNetworkTransaction::DoWriteBodyComplete(int result) { |
| 694 if (result < 0) | 695 if (result < 0) |
| 695 return HandleIOError(result); | 696 return HandleIOError(result); |
| (...skipping 816 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1512 if (target == HttpAuth::AUTH_PROXY) { | 1513 if (target == HttpAuth::AUTH_PROXY) { |
| 1513 auth_info->host = ASCIIToWide(proxy_info_.proxy_server().host_and_port()); | 1514 auth_info->host = ASCIIToWide(proxy_info_.proxy_server().host_and_port()); |
| 1514 } else { | 1515 } else { |
| 1515 DCHECK(target == HttpAuth::AUTH_SERVER); | 1516 DCHECK(target == HttpAuth::AUTH_SERVER); |
| 1516 auth_info->host = ASCIIToWide(request_->url.host()); | 1517 auth_info->host = ASCIIToWide(request_->url.host()); |
| 1517 } | 1518 } |
| 1518 response_.auth_challenge = auth_info; | 1519 response_.auth_challenge = auth_info; |
| 1519 } | 1520 } |
| 1520 | 1521 |
| 1521 } // namespace net | 1522 } // namespace net |
| OLD | NEW |