final boolean sigv4ForGetRequests = ((originalRequest instanceof GetObjectRequest) && !isStandardEnpoint);
if ((upgradeToSigV4() && !(signer instanceof AWSS3V4Signer))
|| (sigv4ForGetRequests)) {
AWSS3V4Signer v4Signer = new AWSS3V4Signer();
// Always set the service name; if the user has overridden it via
// setEndpoint(String, String, String), this will return the right
// value. Otherwise it will return "s3", which is an appropriate
// default.
v4Signer.setServiceName(getServiceNameIntern());
// If the user has set an authentication region override, pass it
// to the signer. Otherwise leave it null - the signer will parse
// region from the request endpoint.
String regionOverride = getSignerRegionOverride();
if (regionOverride == null) {
if (!hasExplicitRegion) {
throw new AmazonClientException(
"Signature Version 4 requires knowing the region of "
+ "the bucket you're trying to access. You can "
+ "configure a region by calling AmazonS3Client."
+ "setRegion(Region) or AmazonS3Client.setEndpoint("
+ "String) with a region-specific endpoint such as "
+ "\"s3-us-west-2.amazonaws.com\".");
}
} else {
v4Signer.setRegionName(regionOverride);
}
return v4Signer;
}