Amazon.S3.Util.BucketRegionDetector.GetCorrectRegion C# (CSharp) 메소드

GetCorrectRegion() 개인적인 정적인 메소드

Detects if the signature is malformed, and the requested bucket is in a Region different from the Region of the request.
private static GetCorrectRegion ( AmazonS3Uri requestedBucketUri, AmazonServiceException serviceException ) : string
requestedBucketUri AmazonS3Uri
serviceException Amazon.Runtime.AmazonServiceException
리턴 string
        private static string GetCorrectRegion(AmazonS3Uri requestedBucketUri, AmazonServiceException serviceException)
        {
            string regionFromExceptionBody = null;
            string regionFromExceptionHeader = null;
            var s3Exception = serviceException as AmazonS3Exception;
            if (s3Exception != null)
            {
                if (string.Equals(s3Exception.ErrorCode, AuthorizationHeaderMalformedErrorCode, StringComparison.Ordinal))
                {
                    regionFromExceptionBody = CheckRegionAndUpdateCache(requestedBucketUri, s3Exception.Region);
                }

                if (regionFromExceptionBody == null)
                {
                    var innerException = s3Exception.InnerException as HttpErrorResponseException;
                    if (innerException != null && innerException.Response != null && innerException.Response.IsHeaderPresent(HeaderKeys.XAmzBucketRegion))
                    {
                        regionFromExceptionHeader = CheckRegionAndUpdateCache(requestedBucketUri, innerException.Response.GetHeaderValue(HeaderKeys.XAmzBucketRegion));
                    }
                }
            }
            return regionFromExceptionBody ?? regionFromExceptionHeader;
        }

Same methods

BucketRegionDetector::GetCorrectRegion ( AmazonS3Uri requestedBucketUri, HttpStatusCode headBucketStatusCode, string xAmzBucketRegionHeaderValue ) : string