Chromium Code Reviews| Index: net/spdy/spdy_http_stream.cc |
| diff --git a/net/spdy/spdy_http_stream.cc b/net/spdy/spdy_http_stream.cc |
| index 6a6abb241f84a1bd83a07c0d3ae822a3a1ffdae4..cb4661f2496ad31ec1df770e6e322f75187317d6 100644 |
| --- a/net/spdy/spdy_http_stream.cc |
| +++ b/net/spdy/spdy_http_stream.cc |
| @@ -175,6 +175,11 @@ void SpdyHttpStream::SetConnectionReused() { |
| // SPDY doesn't need an indicator here. |
| } |
| +void SpdyHttpStream::set_chunk_callback(ChunkCallback* callback) { |
| + if (request_body_stream_ != NULL) |
| + request_body_stream_->set_chunk_callback(callback); |
| +} |
| + |
| int SpdyHttpStream::SendRequest(const HttpRequestHeaders& request_headers, |
| UploadDataStream* request_body, |
| HttpResponseInfo* response, |
| @@ -198,7 +203,7 @@ int SpdyHttpStream::SendRequest(const HttpRequestHeaders& request_headers, |
| CHECK(!request_body_stream_.get()); |
| if (request_body) { |
| - if (request_body->size()) |
| + if (request_body->size() || request_body->is_chunked()) |
| request_body_stream_.reset(request_body); |
| else |
| delete request_body; |
| @@ -258,14 +263,26 @@ int SpdyHttpStream::OnSendBody() { |
| int buf_len = static_cast<int>(request_body_stream_->buf_len()); |
| if (!buf_len) |
| return OK; |
| + bool is_chunked = request_body_stream_->is_chunked(); |
| return stream_->WriteStreamData(request_body_stream_->buf(), buf_len, |
| - spdy::DATA_FLAG_FIN); |
| + is_chunked ? spdy::DATA_FLAG_NONE : spdy::DATA_FLAG_FIN); |
| } |
| -bool SpdyHttpStream::OnSendBodyComplete(int status) { |
| +bool SpdyHttpStream::OnSendBodyComplete(int* status) { |
|
willchan no longer on Chromium
2011/01/27 18:47:49
You're reusing the same parameter for input and ou
Satish
2011/01/27 20:42:09
The function needs the status code as input and re
willchan no longer on Chromium
2011/01/28 00:56:17
OK, I see what's going on here. You should probabl
|
| CHECK(request_body_stream_.get()); |
| - request_body_stream_->MarkConsumedAndFillBuffer(status); |
| - return request_body_stream_->eof(); |
| + request_body_stream_->MarkConsumedAndFillBuffer(*status); |
| + |
| + bool is_chunked = request_body_stream_->is_chunked(); |
| + bool eof = request_body_stream_->eof(); |
| + if (is_chunked && eof) { |
| + *status = stream_->WriteStreamData(request_body_stream_->buf(), 0, |
| + spdy::DATA_FLAG_FIN); |
| + } else { |
| + *status = (!is_chunked || request_body_stream_->buf_len()) ? |
| + OK : ERR_IO_PENDING; |
| + } |
| + |
| + return eof; |
| } |
| int SpdyHttpStream::OnResponseReceived(const spdy::SpdyHeaderBlock& response, |