diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/libstore/download.cc | 5 | ||||
-rw-r--r-- | src/libstore/download.hh | 1 |
2 files changed, 5 insertions, 1 deletions
diff --git a/src/libstore/download.cc b/src/libstore/download.cc index f80c9e45b82e..f0ea1995ae73 100644 --- a/src/libstore/download.cc +++ b/src/libstore/download.cc @@ -140,6 +140,7 @@ struct CurlDownloader : public Downloader size_t writeCallback(void * contents, size_t size, size_t nmemb) { size_t realSize = size * nmemb; + result.bodySize += realSize; if (request.dataCallback) request.dataCallback((char *) contents, realSize); else @@ -162,6 +163,7 @@ struct CurlDownloader : public Downloader auto ss = tokenizeString<vector<string>>(line, " "); status = ss.size() >= 2 ? ss[1] : ""; result.data = std::make_shared<std::string>(); + result.bodySize = 0; encoding = ""; } else { auto i = line.find(':'); @@ -296,6 +298,7 @@ struct CurlDownloader : public Downloader curl_easy_setopt(req, CURLOPT_NETRC, CURL_NETRC_OPTIONAL); result.data = std::make_shared<std::string>(); + result.bodySize = 0; } void finish(CURLcode code) @@ -309,7 +312,7 @@ struct CurlDownloader : public Downloader result.effectiveUrl = effectiveUrlCStr; debug("finished %s of '%s'; curl status = %d, HTTP status = %d, body = %d bytes", - request.verb(), request.uri, code, httpStatus, result.data ? result.data->size() : 0); + request.verb(), request.uri, code, httpStatus, result.bodySize); if (code == CURLE_WRITE_ERROR && result.etag == request.expectedETag) { code = CURLE_OK; diff --git a/src/libstore/download.hh b/src/libstore/download.hh index da55df7a6e71..ff38a2870cc0 100644 --- a/src/libstore/download.hh +++ b/src/libstore/download.hh @@ -38,6 +38,7 @@ struct DownloadResult std::string etag; std::string effectiveUrl; std::shared_ptr<std::string> data; + uint64_t bodySize = 0; }; class Store; |