private static IWebResponseData GetWebData(AmazonServiceException ase) { if (ase != null) { Exception ex = ase; do { HttpErrorResponseException ex2 = ex as HttpErrorResponseException; if (ex2 != null) { return(ex2.Response); } ex = ex.InnerException; }while (ex != null); } return(null); }
private static string GetCorrectRegion(AmazonS3Uri requestedBucketUri, AmazonServiceException serviceException) { string text = null; string text2 = null; AmazonS3Exception ex = serviceException as AmazonS3Exception; if (ex != null) { if (string.Equals(ex.get_ErrorCode(), "AuthorizationHeaderMalformed", StringComparison.Ordinal)) { text = CheckRegionAndUpdateCache(requestedBucketUri, ex.Region); } if (text == null) { HttpErrorResponseException val = ((Exception)ex).InnerException as HttpErrorResponseException; if (val != null && val.get_Response() != null && val.get_Response().IsHeaderPresent("x-amz-bucket-region")) { text2 = CheckRegionAndUpdateCache(requestedBucketUri, val.get_Response().GetHeaderValue("x-amz-bucket-region")); } } } return(text ?? text2); }