Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug/region endpoints #440

Closed
wants to merge 3 commits into from
Closed

Conversation

mdomsch
Copy link
Contributor

@mdomsch mdomsch commented Dec 15, 2014

Help for #402

With the new v4 signature code, we have to send requests to the proper
region.  The default region (US, s3.amazonaws.com) will redirect to
the proper region, but we have to take a redirect to get there.

When --region is specified, and we know that region's endpoint, simply
send the request straight there without being redirected.
Just as we handle --region on the command line, S3 may forward us to a
different region after a request is made.  If so, change our
host_bucket value because S3 told us to.

This moves the set_host_bucket() function out of s3cmd and into S3/S3.py.
Not just s3.amazonaws.com (US1 default), but for all regions.

If you don't specify --region, it was working, because the initial
request would go to s3.amazonaws.com, and we would then globally
disable hsotname checking.  But if you specify --region eu-central-1,
it would fail because hostname checking would remain on.

This patch checks for presence of 'amazonaws.com' in the hostname, and
disables hostname checking.
@mdomsch
Copy link
Contributor Author

mdomsch commented Dec 15, 2014

Ugh. s3cmd cp between buckets in different regions blows up after receiving a HTTP 301 redirect from the source bucket region, saying to use the destination bucket region's endpoint. But that doesn't work either.

This happens whenever you have multiple buckets, in multiple regions, being operated on, not just on the cp operation. rb s3://bucket-region-1 s3://bucket-region/2 also fails, because we're rewriting the host_base now for all buckets, not just for the one being operated on at the moment.

really, endpoint should be tracked on a per-bucket basis, not globally.

@mdomsch
Copy link
Contributor Author

mdomsch commented Dec 16, 2014

this isn't ready for merge. Need to figure out how to handle the redirects correctly, to endpoints when DNS hasn't caught up such that . DNS works yet.

@vamitrou
Copy link
Contributor

Hi, I put an eye on it ASAP

@unixhat
Copy link

unixhat commented Dec 26, 2014

Also me. Many people wait for the patch. Thank you.

@glaszig
Copy link

glaszig commented Jan 23, 2015

this really is a show stopper.

@mdomsch
Copy link
Contributor Author

mdomsch commented Jan 23, 2015

why is it a showstopper? s3cmd works with all regions right now, it's not
not as efficient as it could be network-wise.

On Fri, Jan 23, 2015 at 2:20 PM, glaszig notifications@github.com wrote:

this really is a show stopper.


Reply to this email directly or view it on GitHub
#440 (comment).

@glaszig
Copy link

glaszig commented Jan 24, 2015

with --region=eu-central-1 (s3cmd 1.5.0) i'm getting Warning: Redirected to us-west-1...

@vamitrou
Copy link
Contributor

@glaszig If you don't issue a create bucket command then your output is expected.

Could you post the command you are trying?
If your bucket for example is in us-west-1 and you are trying to access it with --region=eu-central-1 it makes sense to redirect you in eu-central-1.

@glaszig
Copy link

glaszig commented Jan 26, 2015

the issue went away after commenting here. quite weird. i assume it was my fault. sorry and thanks.=

@fviard
Copy link
Contributor

fviard commented Mar 3, 2018

Obsolete PR. Issue is now already fixed in MASTER.

@fviard fviard closed this Mar 3, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants