diff options
author | Carlo Nucera <carlo.nucera@protonmail.com> | 2020-06-17 12:58:59 -0400 |
---|---|---|
committer | Carlo Nucera <carlo.nucera@protonmail.com> | 2020-06-17 12:58:59 -0400 |
commit | 4930cb48a258b0a69a8669602964e3956592ae5c (patch) | |
tree | 3811a38338213f0eec59d7e0228e73a6c8002c27 /src/libstore | |
parent | 079c6e87deb100bf21f35150736f9662557e698e (diff) |
Include review comments
Diffstat (limited to 'src/libstore')
-rw-r--r-- | src/libstore/filetransfer.cc | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/src/libstore/filetransfer.cc b/src/libstore/filetransfer.cc index 081960912..531b85af8 100644 --- a/src/libstore/filetransfer.cc +++ b/src/libstore/filetransfer.cc @@ -72,8 +72,7 @@ struct curlFileTransfer : public FileTransfer curl_off_t writtenToSink = 0; - inline static const std::set<long> successfulStatuses; - + inline static const std::set<long> successfulStatuses {200, 201, 204, 206, 304, 0 /* other protocol */}; /* Get the HTTP status code, or 0 for other protocols. */ long getHTTPStatus() { @@ -100,7 +99,7 @@ struct curlFileTransfer : public FileTransfer /* Only write data to the sink if this is a successful response. */ - if (successfulStatuses.find(httpStatus) != successfulStatuses.end()) { + if (successfulStatuses.count(httpStatus)) { writtenToSink += len; this->request.dataCallback((char *) data, len); } @@ -354,7 +353,7 @@ struct curlFileTransfer : public FileTransfer if (writeException) failEx(writeException); - else if (code == CURLE_OK && successfulStatuses.find(httpStatus) != successfulStatuses.end()) + else if (code == CURLE_OK && successfulStatuses.count(httpStatus)) { result.cached = httpStatus == 304; act.progress(result.bodySize, result.bodySize); |