switch to use region specific endpoints to compute correct v4 signature

fix #133
This commit is contained in:
Ka-Hing Cheung 2015-04-14 12:41:28 -07:00
parent 07e007052a
commit 70097709b2

View File

@ -3102,6 +3102,13 @@ static int s3fs_check_service(void)
LOWSYSLOGPRINT(LOG_ERR, "Could not connect wrong region %s, so retry to connect region %s.", endpoint.c_str(), expectregion.c_str()); LOWSYSLOGPRINT(LOG_ERR, "Could not connect wrong region %s, so retry to connect region %s.", endpoint.c_str(), expectregion.c_str());
FPRN("Could not connect wrong region %s, so retry to connect region %s.", endpoint.c_str(), expectregion.c_str()); FPRN("Could not connect wrong region %s, so retry to connect region %s.", endpoint.c_str(), expectregion.c_str());
endpoint = expectregion; endpoint = expectregion;
if (S3fsCurl::IsSignatureV4()) {
if (host == "http://s3.amazonaws.com") {
host = "http://s3-" + endpoint + ".amazonaws.com";
} else if (host == "https://s3.amazonaws.com") {
host = "https://s3-" + endpoint + ".amazonaws.com";
}
}
// retry to check // retry to check
s3fscurl.DestroyCurlHandle(); s3fscurl.DestroyCurlHandle();