Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions src/libstore/filetransfer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -685,8 +685,12 @@ struct curlFileTransfer : public FileTransfer
if (httpStatus == 404 || httpStatus == 410 || code == CURLE_FILE_COULDNT_READ_FILE) {
// The file is definitely not there
err = NotFound;
} else if (httpStatus == 401 || httpStatus == 403 || httpStatus == 407) {
// Don't retry on authentication/authorization failures
} else if (httpStatus == 401 || httpStatus == 407) {
err = Unauthorized;
} else if (httpStatus == 403) {
// Don't retry on authentication/authorization failures.
// Note: the only reason we treat this differently from 401/407 is S3 returns 403 if a file doesn't
// exist and the bucket is unlistable.
err = Forbidden;
} else if (httpStatus == 429) {
// 429 means too many requests, so we retry (with a substantially longer delay)
Expand Down
2 changes: 1 addition & 1 deletion src/libstore/include/nix/store/filetransfer.hh
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,7 @@ public:
void
download(FileTransferRequest && request, Sink & sink, std::function<void(FileTransferResult)> resultCallback = {});

enum Error { NotFound, Forbidden, Misc, Transient, Interrupted };
enum Error { NotFound, Unauthorized, Forbidden, Misc, Transient, Interrupted };
};

/**
Expand Down
Loading