Index: net/http/http_stream_parser.cc |
diff --git a/net/http/http_stream_parser.cc b/net/http/http_stream_parser.cc |
index 2a3fb156d585a72561361b961458c7657b5501d9..0af2a123dd8c65a574f61f1050537b8681c23092 100644 |
--- a/net/http/http_stream_parser.cc |
+++ b/net/http/http_stream_parser.cc |
@@ -11,6 +11,7 @@ |
#include "net/base/ssl_cert_request_info.h" |
#include "net/http/http_net_log_params.h" |
#include "net/http/http_request_headers.h" |
+#include "net/base/load_flags.h" |
#include "net/http/http_request_info.h" |
#include "net/http/http_response_headers.h" |
#include "net/http/http_util.h" |
@@ -236,7 +237,8 @@ int HttpStreamParser::DoSendHeaders(int result) { |
result = connection_->socket()->Write(request_headers_, |
bytes_remaining, |
&io_callback_); |
- } else if (request_body_ != NULL && request_body_->size()) { |
+ } else if (request_body_ != NULL && |
+ (request_body_->is_chunked() || request_body_->size())) { |
io_state_ = STATE_SENDING_BODY; |
result = OK; |
} else { |
@@ -249,7 +251,12 @@ int HttpStreamParser::DoSendBody(int result) { |
if (result > 0) |
request_body_->DidConsume(result); |
- if (!request_body_->eof()) { |
+ if (request_body_->waiting_for_data()) { |
+ // More POST data is to come, stay in the same state and wait for the |
+ // callback. |
+ request_body_->set_data_callback(&io_callback_); |
+ result = ERR_IO_PENDING; |
+ } else if (!request_body_->eof()) { |
int buf_len = static_cast<int>(request_body_->buf_len()); |
result = connection_->socket()->Write(request_body_->buf(), buf_len, |
&io_callback_); |