mirror of
https://github.com/NixOS/nix.git
synced 2024-11-27 01:02:34 +00:00
Merge pull request #4470 from matthewbauer/fix-4469
Handle missing etag in 304 Not Modified response
This commit is contained in:
commit
c5b42c5a42
@ -64,7 +64,6 @@ DownloadFileResult downloadFile(
|
||||
|
||||
if (res.cached) {
|
||||
assert(cached);
|
||||
assert(request.expectedETag == res.etag);
|
||||
storePath = std::move(cached->storePath);
|
||||
} else {
|
||||
StringSink sink;
|
||||
|
@ -375,6 +375,13 @@ struct curlFileTransfer : public FileTransfer
|
||||
else if (code == CURLE_OK && successfulStatuses.count(httpStatus))
|
||||
{
|
||||
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));
|
||||
|
Loading…
Reference in New Issue
Block a user