Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(462)

Issue 3591018: AU: MultiHttpFetcher, an HttpFetcher for specific byte ranges (Closed)

Created:
10 years, 2 months ago by adlr
Modified:
9 years ago
Reviewers:
petkov
CC:
chromium-os-reviews_chromium.org, petkov, adlr
Base URL:
ssh://git@chromiumos-git/update_engine.git
Visibility:
Public.

Description

AU: MultiHttpFetcher, an HttpFetcher for specific byte ranges MultiHttpFetcher takes an HttpFetcher class via template parameter, and a collection of byte ranges. It hits up the URL multiple times, once per range specified. For each time, it uses a new HttpFetcher of the type specified and fast-forwards to the offset requested, and aborting after enough bytes have been downloaded. Any range many specify a length of -1, which means until the end of the file (as dictated by the server). Thus, a single range of [0, -1] makes MultiHttpFetcher a pass-through. HttpFetcher change: ability to supply an offset. LibcurlHttpFetcher changes: offset support (from HttpFetcher API), ability to be terminted in a write-callback. test_http_fetcher: support for failures in write() on the socket (at least in the /big url case). BUG=7391 TEST=unittests Committed: http://chrome-svn/viewvc/chromeos?view=rev&revision=3fd5d30

Patch Set 1 #

Total comments: 15

Patch Set 2 : fixes for rewview #

Unified diffs Side-by-side diffs Delta from patch set Stats (+423 lines, -32 lines) Patch
M http_fetcher.h View 2 chunks +8 lines, -0 lines 0 comments Download
M http_fetcher_unittest.cc View 10 chunks +151 lines, -5 lines 0 comments Download
M libcurl_http_fetcher.h View 1 4 chunks +20 lines, -1 line 0 comments Download
M libcurl_http_fetcher.cc View 7 chunks +25 lines, -10 lines 0 comments Download
M mock_http_fetcher.h View 1 chunk +3 lines, -0 lines 0 comments Download
A multi_http_fetcher.h View 1 1 chunk +189 lines, -0 lines 0 comments Download
M test_http_server.cc View 4 chunks +27 lines, -16 lines 0 comments Download

Messages

Total messages: 4 (0 generated)
adlr
10 years, 2 months ago (2010-10-08 01:05:22 UTC) #1
petkov
some quick comments, we'll look more later... http://codereview.chromium.org/3591018/diff/1/4 File libcurl_http_fetcher.cc (right): http://codereview.chromium.org/3591018/diff/1/4#newcode304 libcurl_http_fetcher.cc:304: long http_response_code ...
10 years, 2 months ago (2010-10-08 01:41:24 UTC) #2
adlr
address your comments, hopefully... ready for another look. http://codereview.chromium.org/3591018/diff/1/4 File libcurl_http_fetcher.cc (right): http://codereview.chromium.org/3591018/diff/1/4#newcode304 libcurl_http_fetcher.cc:304: long ...
10 years, 2 months ago (2010-10-08 02:50:09 UTC) #3
petkov
10 years, 2 months ago (2010-10-08 03:01:23 UTC) #4
LGTM -- let's get this in and integrate it with the rest of the code to see if
things work. We can refactor and cleanup later, if needed.

http://codereview.chromium.org/3591018/diff/1/7
File multi_http_fetcher.h (right):

http://codereview.chromium.org/3591018/diff/1/7#newcode22
multi_http_fetcher.h:22: template<typename BaseHttpFetcher>
On 2010/10/08 02:50:10, adlr wrote:
> On 2010/10/08 01:41:24, petkov wrote:
> > do you need this to be a template? given that you have virtual methods,
etc...
> > 
> 
> It doesn't need to be a template, but I figured I'd just make it generic. It
> seems cleaner for things to depend on an HttpFetcher API rather than a
> LibcurlHttpFetcher API... anyway, that's why I made it a template.

Ah, I think the answer I was looking for was because you're actually
constructing the fetchers in this class. In general, I don't like templates --
they duplicate code, are hard to read, etc. I would have use a callback or
something like that. Anyway, it's OK given the time frame...

Powered by Google App Engine
This is Rietveld 408576698