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: 85329cac35b3
Choose a base ref
...
head repository: NixOS/nix
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 3cdd46421215
Choose a head ref
  • 2 commits
  • 1 file changed
  • 2 contributors

Commits on Jan 25, 2021

  1. Handle missing etag in 304 Not Modified response

    GitHub now omits the etag, but 304 implies it matches the one we
    provided. Just use that one to avoid having an etag-less resource.
    
    Fixes #4469
    
    (cherry picked from commit a766824)
    matthewbauer committed Jan 25, 2021
    Copy the full SHA
    f95c320 View commit details
  2. Copy the full SHA
    3cdd464 View commit details
Showing with 7 additions and 0 deletions.
  1. +7 −0 src/libstore/download.cc
7 changes: 7 additions & 0 deletions src/libstore/download.cc
Original file line number Diff line number Diff line change
@@ -349,6 +349,13 @@ struct CurlDownloader : public Downloader
(httpStatus == 200 || httpStatus == 201 || httpStatus == 204 || httpStatus == 206 || httpStatus == 304 || httpStatus == 226 /* FTP */ || httpStatus == 0 /* other protocol */))
{
result.cached = httpStatus == 304;

// In 2021, GitHub responds to If-None-Match with 304,
// but omits ETag. We just use the If-None-Match etag
// since 304 implies they are the same.
if (httpStatus == 304 && result.etag == "")
result.etag = request.expectedETag;

act.progress(result.bodySize, result.bodySize);
done = true;
callback(std::move(result));