Commit b4c032d2 authored by Maks Orlovich's avatar Maks Orlovich Committed by Commit Bot

Fix cachetool's dumping of stream 1.

GetStreamForKeyBuffer keeps incrementing offset in GrowableIOBuffer when
it collects things, so at the end data() actually points past the end
(like offset does), and one needs StartOfBuffer() to get to the beginning.

The other implementation of ReturnBuffer already did this.

With this, one can do something like:
 out/Default/cachetool ~/.cache/google-chrome-beta/Default/Cache/ simple get_stream https://www.chromium.org/ 1  > /tmp/file.txt
to see what's in the cache --- and in chromium.org's case, I needed zcat to view it, since it was gzipped.
(passing 0 instead of 1 would demarshal the HttpResponseInfo that goes with the body).

Change-Id: Id3b5608e2845f9404c2c3c21d53e7ce723f13320
Reviewed-on: https://chromium-review.googlesource.com/825102Reviewed-by: default avatarPaul Jensen <pauljensen@chromium.org>
Commit-Queue: Maks Orlovich <morlovich@chromium.org>
Cr-Commit-Position: refs/heads/master@{#523845}
parent 4d08cfa6
...@@ -194,7 +194,7 @@ class ProgramArgumentCommandMarshal final : public CommandMarshal { ...@@ -194,7 +194,7 @@ class ProgramArgumentCommandMarshal final : public CommandMarshal {
// Implements CommandMarshal. // Implements CommandMarshal.
void ReturnBuffer(net::GrowableIOBuffer* buffer) override { void ReturnBuffer(net::GrowableIOBuffer* buffer) override {
DCHECK(!has_failed()); DCHECK(!has_failed());
std::cout.write(buffer->data(), buffer->offset()); std::cout.write(buffer->StartOfBuffer(), buffer->offset());
} }
// Implements CommandMarshal. // Implements CommandMarshal.
......
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