mirror of
https://github.com/NixOS/nix
synced 2025-07-08 06:53:54 +02:00
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 a766824660
)
This commit is contained in:
parent
3a6a2f88f2
commit
f95c320500
1 changed files with 7 additions and 0 deletions
|
@ -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));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue