Skip to content

Commit

Permalink
cgi parameters have been sorted YQ-2558 (#619)
Browse files Browse the repository at this point in the history
  • Loading branch information
dorooleg authored Dec 21, 2023
1 parent cf1d26d commit 3f77b66
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 7 deletions.
14 changes: 11 additions & 3 deletions ydb/library/yql/providers/s3/actors/yql_s3_applicator_actor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,15 +83,19 @@ struct TListMultipartUploads {
}

TString BuildUrl() const {
// We have to sort the cgi parameters for the correct aws signature
// This requirement will be fixed in the curl library
// https://github.com/curl/curl/commit/fc76a24c53b08cdf6eec8ba787d8eac64651d56e
// https://github.com/curl/curl/commit/c87920353883ef9d5aa952e724a8e2589d76add5
TUrlBuilder urlBuilder(Url);
urlBuilder.AddUrlParam("uploads");
urlBuilder.AddUrlParam("prefix", Prefix);
if (KeyMarker) {
urlBuilder.AddUrlParam("key-marker", KeyMarker);
}
urlBuilder.AddUrlParam("prefix", Prefix);
if (UploadIdMarker) {
urlBuilder.AddUrlParam("upload-id-marker", UploadIdMarker);
}
urlBuilder.AddUrlParam("uploads");
return urlBuilder.Build();
}
};
Expand Down Expand Up @@ -133,11 +137,15 @@ struct TListParts {
}

TString BuildUrl() const {
// We have to sort the cgi parameters for the correct aws signature
// This requirement will be fixed in the curl library
// https://github.com/curl/curl/commit/fc76a24c53b08cdf6eec8ba787d8eac64651d56e
// https://github.com/curl/curl/commit/c87920353883ef9d5aa952e724a8e2589d76add5
TUrlBuilder urlBuilder(Url);
urlBuilder.AddUrlParam("uploadId", UploadId);
if (PartNumberMarker) {
urlBuilder.AddUrlParam("part-number-marker", PartNumberMarker);
}
urlBuilder.AddUrlParam("uploadId", UploadId);
return urlBuilder.Build();
}
};
Expand Down
13 changes: 9 additions & 4 deletions ydb/library/yql/providers/s3/object_listers/yql_s3_list.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -287,18 +287,23 @@ class TS3Lister : public IS3Lister {
private:
static void SubmitRequestIntoGateway(TListingContext& ctx) {
IHTTPGateway::THeaders headers = IHTTPGateway::MakeYcHeaders(ctx.RequestId, ctx.ListingRequest.AuthInfo.GetToken(), {}, ctx.ListingRequest.AuthInfo.GetAwsUserPwd(), ctx.ListingRequest.AuthInfo.GetAwsSigV4());
TUrlBuilder urlBuilder(ctx.ListingRequest.Url);
urlBuilder.AddUrlParam("list-type", "2")
.AddUrlParam("prefix", ctx.ListingRequest.Prefix)
.AddUrlParam("max-keys", TStringBuilder() << ctx.MaxKeys);

// We have to sort the cgi parameters for the correct aws signature
// This requirement will be fixed in the curl library
// https://github.com/curl/curl/commit/fc76a24c53b08cdf6eec8ba787d8eac64651d56e
// https://github.com/curl/curl/commit/c87920353883ef9d5aa952e724a8e2589d76add5
TUrlBuilder urlBuilder(ctx.ListingRequest.Url);
if (ctx.ContinuationToken.Defined()) {
urlBuilder.AddUrlParam("continuation-token", *ctx.ContinuationToken);
}
if (ctx.Delimiter.Defined()) {
urlBuilder.AddUrlParam("delimiter", *ctx.Delimiter);
}

urlBuilder.AddUrlParam("list-type", "2")
.AddUrlParam("max-keys", TStringBuilder() << ctx.MaxKeys)
.AddUrlParam("prefix", ctx.ListingRequest.Prefix);

auto gateway = ctx.GatewayWeak.lock();
if (!gateway) {
ythrow yexception() << "Gateway disappeared";
Expand Down

0 comments on commit 3f77b66

Please sign in to comment.