Skip to content

Commit 1d012db

Browse files
committed
refactor(libstore): s3ToHttpsUrl :: ParsedS3URL -> ParsedUrl
1 parent de90490 commit 1d012db

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

src/libstore/filetransfer.cc

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,8 @@ struct curlFileTransfer : public FileTransfer
144144
// Handle S3 URLs with curl-based AWS SigV4 authentication
145145
if (hasPrefix(request.uri, "s3://")) {
146146
try {
147-
auto [httpsUrl, parsed] = fileTransfer.convertS3ToHttpsUri(request.uri);
147+
auto parsed = ParsedS3URL::parse(request.uri);
148+
auto httpsUrl = fileTransfer.s3ToHttpsUrl(parsed);
148149

149150
// Update the request URI to use HTTPS
150151
const_cast<FileTransferRequest &>(request).uri = httpsUrl.to_string();
@@ -872,12 +873,10 @@ struct curlFileTransfer : public FileTransfer
872873

873874
#if NIX_WITH_S3_SUPPORT
874875
/**
875-
* Convert S3 URI to HTTPS URI for use with curl's AWS SigV4 authentication
876+
* Convert ParsedS3URL to HTTPS ParsedURL for use with curl's AWS SigV4 authentication
876877
*/
877-
std::pair<ParsedURL, ParsedS3URL> convertS3ToHttpsUri(const std::string & s3Uri)
878+
ParsedURL s3ToHttpsUrl(const ParsedS3URL & parsed)
878879
{
879-
auto parsed = ParsedS3URL::parse(s3Uri);
880-
881880
std::string region = parsed.region.value_or("us-east-1");
882881
std::string scheme = parsed.scheme.value_or("https");
883882

@@ -904,7 +903,7 @@ struct curlFileTransfer : public FileTransfer
904903
httpsUrl.authority = ParsedURL::Authority{.host = "s3." + region + ".amazonaws.com"};
905904
}
906905

907-
return {httpsUrl, parsed};
906+
return httpsUrl;
908907
}
909908
#endif
910909
void enqueueFileTransfer(const FileTransferRequest & request, Callback<FileTransferResult> callback) override

0 commit comments

Comments
 (0)