From a83bf2428197abfedea9639799213d6b0581ea14 Mon Sep 17 00:00:00 2001 From: eldritch horrors Date: Sat, 26 Oct 2024 14:46:16 +0200 Subject: [PATCH] libstore: remove FileTransferRequest::mimeType it's only used by HttpBinaryCacheStore, and even there used in only on place. this one place can set the header explicitly, which it now does Change-Id: Id89228150669e25e7f59a3d6bd939e46059ce29e --- src/libstore/filetransfer.cc | 2 -- src/libstore/filetransfer.hh | 1 - src/libstore/http-binary-cache-store.cc | 2 +- 3 files changed, 1 insertion(+), 4 deletions(-) diff --git a/src/libstore/filetransfer.cc b/src/libstore/filetransfer.cc index acbb042b7..4a0638dc6 100644 --- a/src/libstore/filetransfer.cc +++ b/src/libstore/filetransfer.cc @@ -97,8 +97,6 @@ struct curlFileTransfer : public FileTransfer requestHeaders = curl_slist_append(requestHeaders, "Accept-Encoding: zstd, br, gzip, deflate, bzip2, xz"); if (!request.expectedETag.empty()) requestHeaders = curl_slist_append(requestHeaders, ("If-None-Match: " + request.expectedETag).c_str()); - if (!request.mimeType.empty()) - requestHeaders = curl_slist_append(requestHeaders, ("Content-Type: " + request.mimeType).c_str()); for (auto it = request.headers.begin(); it != request.headers.end(); ++it){ requestHeaders = curl_slist_append(requestHeaders, fmt("%s: %s", it->first, it->second).c_str()); } diff --git a/src/libstore/filetransfer.hh b/src/libstore/filetransfer.hh index 4352cb81b..534b4b104 100644 --- a/src/libstore/filetransfer.hh +++ b/src/libstore/filetransfer.hh @@ -63,7 +63,6 @@ struct FileTransferRequest unsigned int baseRetryTimeMs = 250; ActivityId parentAct; std::optional data; - std::string mimeType; FileTransferRequest(std::string_view uri) : uri(uri), parentAct(getCurActivity()) { } diff --git a/src/libstore/http-binary-cache-store.cc b/src/libstore/http-binary-cache-store.cc index ab8ad1399..ea75768bd 100644 --- a/src/libstore/http-binary-cache-store.cc +++ b/src/libstore/http-binary-cache-store.cc @@ -134,7 +134,7 @@ protected: { FileTransferRequest req{makeURI(path)}; req.data = StreamToSourceAdapter(istream).drain(); - req.mimeType = mimeType; + req.headers = {{"Content-Type", mimeType}}; try { getFileTransfer()->transfer(req); } catch (FileTransferError & e) {