Skip to content

PXB-3498: [xbcloud] Fix HTTP request signing when retrying #1650

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: trunk
Choose a base branch
from

Conversation

imrivera
Copy link

@imrivera imrivera commented Apr 10, 2025

Using xbcloud, when there is a problem downloading a file and it's going to be retried, the new request should be signed again for S3 and Azure. But the parameters used were only valid for S3.

That means that if you're downloading from Azure, once a file fails to download, the retry is going to miscalculate the authorization token, that would receive a 403 Unauthorized and the whole downloading process stop.

This PR fixes that problem. The approach is encapsulating the signing process and the related data in a std::function in the Http_request object. This way, you just have to call req->sign() to resign the request, you don't need to know what data it needs, etc.

This bug was found in a production service. The fix was also tested in the same service with successful result.

@@ -634,8 +634,7 @@ void Http_client::callback(CLIENT *client, std::string container,
delay, name.c_str(), count);
std::this_thread::sleep_for(std::chrono::milliseconds(delay));
resp->reset_body();
client->signer->sign_request(client->hostname(container), container, *req,
Copy link
Author

@imrivera imrivera Apr 10, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the main problem. These parameters are correct for S3, but not for Azure (for Azure they should be container and name)

@imrivera imrivera changed the title Fix HTTP request signing when retrying [xbcloud] Fix HTTP request signing when retrying Apr 10, 2025
@satya-bodapati
Copy link
Contributor

Thank you for the contribution: I've created JIRA for this issue: https://perconadev.atlassian.net/browse/PXB-3498

@satya-bodapati satya-bodapati changed the title [xbcloud] Fix HTTP request signing when retrying PXB-3498: [xbcloud] Fix HTTP request signing when retrying May 1, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants