Skip to content
This repository has been archived by the owner on Mar 4, 2024. It is now read-only.

Added support for v4 signing to S3. #27

Merged
merged 3 commits into from Mar 1, 2015

Conversation

kat-co
Copy link

@kat-co kat-co commented Feb 11, 2015

  • S3 constructor now takes a Signer function. This indicates the preferred signing methodology.
  • Users can still use the recommended type of signing by using the Signer defined on the region.

@kat-co
Copy link
Author

kat-co commented Feb 11, 2015

Most of this PR is switching the S3 requests over to vanilla http.Request structures. This was done because the new AWS signing operates on these.

- S3 constructor now takes a Signer function. This indicates the preferred signing methodology.
- Users can still use the recommended type of signing by using the Signer defined on the region.
if r.S3BucketEndpoint != "" {
return strings.Replace(r.S3BucketEndpoint, "${bucket}", bucketName, -1)
}
return r.S3Endpoint + "/" + bucketName + "/"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

path.Join here instead?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

path.Join scrubs the content and will remove one of the slashes in "http://" in the r.S3Endpoint.

@dimitern
Copy link

Most of this looks good, however dropping the 2 methods I can't quite get. Also, have you tried running all the s3 tests with -amazon to make sure both the s3test server still works (I'm assuming tests pass, otherwise travis CI would've reported it) and the changes work against live AWS and s3test the same way?

@dimitern
Copy link

Sorry, I've seen this is actually targeted to v3-unstable, so changes to the interface is fine at this point. However, I still think URL is worth keeping as a method. I'd like to have another look when you're done with the tests.

if req.Body != nil {
if b, err := ioutil.ReadAll(req.Body); err != nil {
return "", err
} else {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd pull b, err := ioutil.ReadAll(..) before the if and drop the else clause to reduce the indentation level.

@dimitern
Copy link

dimitern commented Mar 1, 2015

All in all it looks fine, but I'm getting some s3 test failures in both local and live tests. I've sent you a mail with more details.

@dimitern
Copy link

dimitern commented Mar 1, 2015

LGTM with the patch discussed on IRC: http://pastebin.ubuntu.com/10490009/ which makes s3 live tests to pass reliably. However, a side-effect of that is leaving a bunch of buckets after each live test run - please, add an issue for this as well. When we have time, we'll fix it.

- Minor formatting issues.
- Changed skip message to a comment. Now referencing bug#.
- Documentation cleaned up.
@dimitern
Copy link

dimitern commented Mar 1, 2015

Great, I'm merging this.

dimitern pushed a commit that referenced this pull request Mar 1, 2015
Added support for v4 signing to S3.
@dimitern dimitern merged commit 07316ca into go-amz:v3-unstable Mar 1, 2015
@kat-co kat-co deleted the v3-unstable branch March 13, 2015 16:12
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants