Commit 3dc8c88b authored by mmenke's avatar mmenke Committed by Commit bot

Allow URLRequest::AppendChunkToUpload to take 0-byte final chunks.

Also add HttpStreamParser unit tests for 0 byte final chunks.

BUG=405678

Review URL: https://codereview.chromium.org/921453003

Cr-Commit-Position: refs/heads/master@{#317051}
parent 1a8aa27d
This diff is collapsed.
...@@ -209,7 +209,6 @@ void URLRequest::AppendChunkToUpload(const char* bytes, ...@@ -209,7 +209,6 @@ void URLRequest::AppendChunkToUpload(const char* bytes,
bool is_last_chunk) { bool is_last_chunk) {
DCHECK(upload_data_stream_); DCHECK(upload_data_stream_);
DCHECK(upload_data_stream_->is_chunked()); DCHECK(upload_data_stream_->is_chunked());
DCHECK_GT(bytes_len, 0);
upload_chunked_data_stream_->AppendData(bytes, bytes_len, is_last_chunk); upload_chunked_data_stream_->AppendData(bytes, bytes_len, is_last_chunk);
} }
......
...@@ -303,10 +303,14 @@ class NET_EXPORT URLRequest : NON_EXPORTED_BASE(public base::NonThreadSafe), ...@@ -303,10 +303,14 @@ class NET_EXPORT URLRequest : NON_EXPORTED_BASE(public base::NonThreadSafe),
void EnableChunkedUpload(); void EnableChunkedUpload();
// Appends the given bytes to the request's upload data to be sent // Appends the given bytes to the request's upload data to be sent
// immediately via chunked transfer encoding. When all data has been sent, // immediately via chunked transfer encoding. When all data has been added,
// call MarkEndOfChunks() to indicate the end of upload data. // set |is_last_chunk| to true to indicate the end of upload data. All chunks
// but the last must have |bytes_len| > 0.
// //
// This method may be called only after calling EnableChunkedUpload(). // This method may be called only after calling EnableChunkedUpload().
//
// Despite the name of this method, over-the-wire chunk boundaries will most
// likely not match the "chunks" appended with this function.
void AppendChunkToUpload(const char* bytes, void AppendChunkToUpload(const char* bytes,
int bytes_len, int bytes_len,
bool is_last_chunk); bool is_last_chunk);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment