Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: NixOS/nix
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 9ed097db7bc0
Choose a base ref
...
head repository: NixOS/nix
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 96f3c36709a8
Choose a head ref
  • 2 commits
  • 1 file changed
  • 1 contributor

Commits on Apr 8, 2020

  1. Verified

    This commit was signed with the committer’s verified signature.
    edolstra Eelco Dolstra
    Copy the full SHA
    1ab8d6a View commit details
  2. Merge pull request #3478 from edolstra/ignore-failed-data

    Downloader: Only write data to the sink on a 200 response
    edolstra authored Apr 8, 2020

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    96f3c36 View commit details
Showing with 9 additions and 2 deletions.
  1. +9 −2 src/libstore/download.cc
11 changes: 9 additions & 2 deletions src/libstore/download.cc
Original file line number Diff line number Diff line change
@@ -83,8 +83,15 @@ struct CurlDownloader : public Downloader
, callback(std::move(callback))
, finalSink([this](const unsigned char * data, size_t len) {
if (this->request.dataCallback) {
writtenToSink += len;
this->request.dataCallback((char *) data, len);
long httpStatus = 0;
curl_easy_getinfo(req, CURLINFO_RESPONSE_CODE, &httpStatus);

/* Only write data to the sink if this is a
successful response. */
if (httpStatus == 0 || httpStatus == 200 || httpStatus == 201 || httpStatus == 206) {
writtenToSink += len;
this->request.dataCallback((char *) data, len);
}
} else
this->result.data->append((char *) data, len);
})