Chromium Code Reviews| Index: net/base/upload_data.cc |
| diff --git a/net/base/upload_data.cc b/net/base/upload_data.cc |
| index 490029cda28b2f6ed2346acd5cbeb3728de54401..bbf722928ef0250bdf6636827ad16f8a021b4180 100644 |
| --- a/net/base/upload_data.cc |
| +++ b/net/base/upload_data.cc |
| @@ -28,16 +28,12 @@ UploadData::Element::~Element() { |
| delete file_stream_; |
| } |
| -void UploadData::Element::SetToChunk(const char* bytes, int bytes_len) { |
| - std::string chunk_length = StringPrintf("%X\r\n", bytes_len); |
| +void UploadData::Element::SetToChunk(const char* bytes, int bytes_len, |
|
willchan no longer on Chromium
2011/03/03 19:47:48
http://dev.chromium.org/developers/coding-style#Co
|
| + bool is_last_chunk) { |
| bytes_.clear(); |
| - bytes_.insert(bytes_.end(), chunk_length.data(), |
| - chunk_length.data() + chunk_length.length()); |
| bytes_.insert(bytes_.end(), bytes, bytes + bytes_len); |
| - const char* crlf = "\r\n"; |
| - bytes_.insert(bytes_.end(), crlf, crlf + 2); |
| type_ = TYPE_CHUNK; |
| - is_last_chunk_ = (bytes_len == 0); |
| + is_last_chunk_ = is_last_chunk; |
| } |
| uint64 UploadData::Element::GetContentLength() { |
| @@ -146,10 +142,11 @@ void UploadData::AppendBlob(const GURL& blob_url) { |
| elements_.back().SetToBlobUrl(blob_url); |
| } |
| -void UploadData::AppendChunk(const char* bytes, int bytes_len) { |
| +void UploadData::AppendChunk(const char* bytes, int bytes_len, |
|
willchan no longer on Chromium
2011/03/03 19:47:48
http://dev.chromium.org/developers/coding-style#Co
|
| + bool is_last_chunk) { |
| DCHECK(is_chunked_); |
| elements_.push_back(Element()); |
| - elements_.back().SetToChunk(bytes, bytes_len); |
| + elements_.back().SetToChunk(bytes, bytes_len, is_last_chunk); |
| if (chunk_callback_) |
| chunk_callback_->OnChunkAvailable(); |
| } |