aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoreldritch horrors <pennae@lix.systems>2024-04-22 21:03:02 +0200
committereldritch horrors <pennae@lix.systems>2024-04-23 01:04:56 +0000
commit257d7ffa7b3d1f12e76895231d79acbc2d7a696d (patch)
tree9a96182e33ef0bb91317b4e4cbc41d5715fb3b9d
parent7063170d5fd7220c30186ba9eaaa7e2627b30c9a (diff)
libstore: remove github etag workaround
this was a workaround for a *github* bug that happend *in 2015*. not only is github no longer buggy, it shouldn't have been nix's responsibility to work around these bugs like this to begin with while we're at it we'll also remove another workaround—again for github specifically and again for etag handling—from 2021 that's also not needed any more. future workarounds for serverside bugs should probably come with an expiration date that mutates into a build warning after a while, otherwise this *will* happen again. Change-Id: I74f739ae3e36d40350f78bebcb5869aa8cc9adcd
-rw-r--r--src/libstore/filetransfer.cc23
1 files changed, 0 insertions, 23 deletions
diff --git a/src/libstore/filetransfer.cc b/src/libstore/filetransfer.cc
index 7d36796f4..adbeb58ca 100644
--- a/src/libstore/filetransfer.cc
+++ b/src/libstore/filetransfer.cc
@@ -204,17 +204,6 @@ struct curlFileTransfer : public FileTransfer
if (name == "etag") {
result.etag = trim(line.substr(i + 1));
- /* Hack to work around a GitHub bug: it sends
- ETags, but ignores If-None-Match. So if we get
- the expected ETag on a 200 response, then shut
- down the connection because we already have the
- data. */
- long httpStatus = 0;
- curl_easy_getinfo(req, CURLINFO_RESPONSE_CODE, &httpStatus);
- if (result.etag == request.expectedETag && httpStatus == 200) {
- debug("shutting down on 200 HTTP response with expected ETag");
- return 0;
- }
}
else if (name == "content-encoding")
@@ -375,24 +364,12 @@ struct curlFileTransfer : public FileTransfer
}
}
- if (code == CURLE_WRITE_ERROR && result.etag == request.expectedETag) {
- code = CURLE_OK;
- httpStatus = 304;
- }
-
if (writeException)
failEx(writeException);
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));