Skip to content
This repository has been archived by the owner on Apr 21, 2023. It is now read-only.

Commit

Permalink
Clear the destination HTTPValue before trying to write it.
Browse files Browse the repository at this point in the history
  • Loading branch information
jmarantz committed Jan 19, 2016
1 parent 21d6c82 commit d3851dd
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions net/instaweb/http/inflating_fetch.cc
Expand Up @@ -122,6 +122,7 @@ bool InflatingFetch::UnGzipValueIfCompressed(const HTTPValue& src,
headers->Remove(HttpAttributes::kContentEncoding, HttpAttributes::kGzip);
headers->SetContentLength(inflated.length());
content.set(inflated.c_str(), inflated.length());
dest->Clear();
dest->Write(content, handler);
dest->SetHeaders(headers);
return true;
Expand Down
3 changes: 3 additions & 0 deletions net/instaweb/http/inflating_fetch_test.cc
Expand Up @@ -326,6 +326,9 @@ TEST(StaticInflatingFetchTest, CompressUncompressValue) {
headers.Lookup1(HttpAttributes::kContentEncoding));
compressed_value.ExtractHeaders(&headers, &handler);
HTTPValue uncompressed_value;
ResponseHeaders temp_headers;
temp_headers.Add("a", "b");
uncompressed_value.SetHeaders(&temp_headers);
ASSERT_TRUE(InflatingFetch::UnGzipValueIfCompressed(
compressed_value, &headers, &uncompressed_value, &handler));
uncompressed_value.ExtractContents(&contents);
Expand Down

0 comments on commit d3851dd

Please sign in to comment.