appoxy/aws — pull request #110 by marios (2012-04-27 13:10:06+00:00)
Title: Grab Endpoint from PermanentRedirect XML body when this is returned

Hi,

please consider this minor edit. The scenario is:

* create a bucket "marios-test-bucket.foo" in ap-north-east-1 and then try to access this from a different server endpoint - such as ap-south-east-1, i.e.:

client = Aws::S3.new("KEY", "SECRET", {:server=>"s3-ap-southeast-1.amazonaws.com", :connection_mode=>:per_thread})
bucket = client.bucket("marios-test-bucket.foo")
bucket.keys

* AWS responds with "301 Moved Permanently":

>> response
=> #

>> response.body
=> "\n

PermanentRedirect
The bucket you are attempting to access must be addressed using the specified endpoint. Please send all future requests to this endpoint.
414883F22C6F5799
marios-test-bucket.foo
CkUSF4xXXgrt8/ggfBrEudibTUn6E0tbPHU72k7FhSeeAeTtTMIiWVywFTGilZja
marios-test-bucket.foo.s3-ap-northeast-1.amazonaws.com
"

* This minor edit grabs the Endpoint from the response and lets the code retry the connection

I noticed that this code was commented out in the first place (from the parser I mean) and was wondering if there was a reason for that (introduced other problems?),

thanks for your time, marios