mirror of
https://github.com/apple/foundationdb.git
synced 2025-05-15 18:32:18 +08:00
[fdbbackup] check for credentials inside of setAuthHeaders
This commit is contained in:
parent
4059b1f570
commit
b10ea7677e
@ -661,9 +661,8 @@ ACTOR Future<Reference<HTTP::Response>> doRequest_impl(Reference<S3BlobStoreEndp
|
||||
// Finish/update the request headers (which includes Date header)
|
||||
// This must be done AFTER the connection is ready because if credentials are coming from disk they are
|
||||
// refreshed when a new connection is established and setAuthHeaders() would need the updated secret.
|
||||
if (bstore->credentials.present()) {
|
||||
bstore->setAuthHeaders(bstore->credentials.get(), verb, resource, headers);
|
||||
}
|
||||
bstore->setAuthHeaders(verb, resource, headers);
|
||||
|
||||
remoteAddress = rconn.conn->getPeerAddress();
|
||||
wait(bstore->requestRate->getAllowance(1));
|
||||
Reference<HTTP::Response> _r = wait(timeoutError(HTTP::doRequest(rconn.conn,
|
||||
@ -1086,7 +1085,12 @@ std::string S3BlobStoreEndpoint::hmac_sha1(Credentials const &creds, std::string
|
||||
return SHA1::from_string(kopad);
|
||||
}
|
||||
|
||||
void S3BlobStoreEndpoint::setAuthHeaders(Credentials const &creds, std::string const& verb, std::string const& resource, HTTP::Headers& headers) {
|
||||
void S3BlobStoreEndpoint::setAuthHeaders(std::string const& verb, std::string const& resource, HTTP::Headers& headers) {
|
||||
if (!credentials.present()) {
|
||||
return;
|
||||
}
|
||||
Credentials creds = credentials.get();
|
||||
|
||||
std::string& date = headers["Date"];
|
||||
|
||||
char dateBuf[20];
|
||||
|
@ -166,7 +166,7 @@ public:
|
||||
static std::string hmac_sha1(Credentials const &creds, std::string const &msg);
|
||||
|
||||
// Sets headers needed for Authorization (including Date which will be overwritten if present)
|
||||
void setAuthHeaders(Credentials const &creds, std::string const &verb, std::string const &resource, HTTP::Headers &headers);
|
||||
void setAuthHeaders(std::string const& verb, std::string const& resource, HTTP::Headers& headers);
|
||||
|
||||
// Prepend the HTTP request header to the given PacketBuffer, returning the new head of the buffer chain
|
||||
static PacketBuffer* writeRequestHeader(std::string const& request,
|
||||
|
Loading…
x
Reference in New Issue
Block a user