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

Add functionality to make a url signed for a HEAD request to S4 driver #63

Merged
merged 1 commit into from
Jan 15, 2015

Conversation

AndreyKostov
Copy link
Contributor

Wait until https://github.com/crowdmob/goamz/pull/319 is merged before merging this.

Update: It was merged.

if method != "GET" && method != "HEAD" {
return "", storagedriver.ErrUnsupportedMethod
}
methodString, _ = method.(string)
Copy link
Collaborator

Choose a reason for hiding this comment

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

This will panic if the method is not a string. It should be something like this:

m, ok  = method.(string)
if !ok || (m != "GET" && m != "HEAD") {
    return "", storagedriver.ErrUnsupportedMethod
}
methodString = m

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It will not, because you will never reach the line if method is not either the string "GET" or the string "HEAD"

Copy link
Collaborator

Choose a reason for hiding this comment

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

Exactly. That statement continuing to not crash relies on a side-effect of the if statement above. If this condition gets changed in any way such that the guarantee is removed, it will crash, unexpectedly.

@stevvooe
Copy link
Collaborator

Waiting on LGTM from @BrianBland.

@BrianBland
Copy link
Contributor

LGTM, I'll submit a PR in a moment with the remaining changes to LayerHandler

@BrianBland
Copy link
Contributor

Verified to work for both v2 and v4 auth.

@stevvooe stevvooe added this to the Registry/Beta milestone Jan 15, 2015
stevvooe added a commit that referenced this pull request Jan 15, 2015
Add functionality to make a url signed for a HEAD request to S4 driver
@stevvooe stevvooe merged commit effa09b into distribution:master Jan 15, 2015
@stevvooe stevvooe mentioned this pull request Mar 5, 2015
4 tasks
@stevvooe stevvooe modified the milestones: Registry/2.0.0-beta, Registry/2.0 Mar 31, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants