• Maks Orlovich's avatar
    Fix cachetool's dumping of stream 1. · b4c032d2
    Maks Orlovich authored
    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}
    b4c032d2
cachetool.cc 22.1 KB