PXB-3498: [xbcloud] Fix HTTP request signing when retrying #1650
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 theHttp_request
object. This way, you just have to callreq->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.