| Index: net/http/http_stream_parser.cc
|
| diff --git a/net/http/http_stream_parser.cc b/net/http/http_stream_parser.cc
|
| index b85a342dda979f2bb178024d63ebd18535217112..1b1f02aad77bf1f7c39c3590602632635bdc0ce8 100644
|
| --- a/net/http/http_stream_parser.cc
|
| +++ b/net/http/http_stream_parser.cc
|
| @@ -128,10 +128,10 @@ int HttpStreamParser::SendRequest(const std::string& request_line,
|
| request_body_.reset(request_body);
|
| if (request_body_ != NULL && request_body_->is_chunked()) {
|
| request_body_->set_chunk_callback(this);
|
| - // The raw chunk buffer is guaranteed to be large enough to hold the
|
| - // encoded chunk.
|
| - raw_chunk_buf_ = new IOBufferWithSize(UploadDataStream::GetBufferSize() +
|
| - kChunkHeaderFooterSize);
|
| + // The chunk buffer is guaranteed to be large enough to hold the encoded
|
| + // chunk.
|
| + chunk_buf_ = new SeekableIOBuffer(UploadDataStream::GetBufferSize() +
|
| + kChunkHeaderFooterSize);
|
| }
|
|
|
| io_state_ = STATE_SENDING_HEADERS;
|
| @@ -349,13 +349,11 @@ int HttpStreamParser::DoSendChunkedBody(int result) {
|
| // DoSendChunkedBody(), or 0 (i.e. OK) the first time.
|
|
|
| // Send the remaining data in the chunk buffer.
|
| - if (chunk_buf_.get()) {
|
| - chunk_buf_->DidConsume(result);
|
| - if (chunk_buf_->BytesRemaining() > 0) {
|
| - return connection_->socket()->Write(chunk_buf_,
|
| - chunk_buf_->BytesRemaining(),
|
| - io_callback_);
|
| - }
|
| + chunk_buf_->DidConsume(result);
|
| + if (chunk_buf_->BytesRemaining() > 0) {
|
| + return connection_->socket()->Write(chunk_buf_,
|
| + chunk_buf_->BytesRemaining(),
|
| + io_callback_);
|
| }
|
|
|
| if (sent_last_chunk_) {
|
| @@ -369,17 +367,19 @@ int HttpStreamParser::DoSendChunkedBody(int result) {
|
| chunk_length_without_encoding_ = 0;
|
|
|
| if (request_body_->eof()) {
|
| + chunk_buf_->Clear();
|
| const int chunk_length = EncodeChunk(
|
| - base::StringPiece(), raw_chunk_buf_->data(), raw_chunk_buf_->size());
|
| - chunk_buf_ = new DrainableIOBuffer(raw_chunk_buf_, chunk_length);
|
| + base::StringPiece(), chunk_buf_->data(), chunk_buf_->capacity());
|
| + chunk_buf_->DidAppend(chunk_length);
|
| sent_last_chunk_ = true;
|
| } else if (request_body_->buf_len() > 0) {
|
| // Encode and send the buffer as 1 chunk.
|
| const base::StringPiece payload(request_body_->buf()->data(),
|
| request_body_->buf_len());
|
| + chunk_buf_->Clear();
|
| const int chunk_length = EncodeChunk(
|
| - payload, raw_chunk_buf_->data(), raw_chunk_buf_->size());
|
| - chunk_buf_ = new DrainableIOBuffer(raw_chunk_buf_, chunk_length);
|
| + payload, chunk_buf_->data(), chunk_buf_->capacity());
|
| + chunk_buf_->DidAppend(chunk_length);
|
| chunk_length_without_encoding_ = payload.size();
|
| } else {
|
| // Nothing to send. More POST data is yet to come?
|
|
|