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 new API PresignedHeadObject method. #798

Merged
merged 2 commits into from
Aug 29, 2017
Merged

Conversation

harshavardhana
Copy link
Member

This PR borrows original work from @dmage in PR #770

### PresignedHeadObject(bucketName, objectName string, expiry time.Duration, reqParams url.Values) (*url.URL, error)

Generates a presigned URL for HTTP HEAD operations. Browsers/Mobile clients may point to this URL to directly get metadata from objects even if the bucket is private. This presigned URL can have an associated expiration time in seconds after which it is no longer operational. The default expiry is set to 7 days.

Copy link
Contributor

Choose a reason for hiding this comment

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

shouldn't this read - The maximum expiry is set to 7 days?

Copy link
Member Author

Choose a reason for hiding this comment

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

No default is 7 days if not set that is.

Copy link
Member

@vadmeste vadmeste Aug 26, 2017

Choose a reason for hiding this comment

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

But also the maximum is 7 days AFAIK

api-presigned.go Outdated
// PresignedPutObject - Returns a presigned URL to upload an object without credentials.
// Expires maximum is 7days - ie. 604800 and minimum is 1.
func (c Client) PresignedPutObject(bucketName string, objectName string, expires time.Duration) (u *url.URL, err error) {
return c.presignURL("PUT", bucketName, objectName, expires, nil)
}

// Presign - returns a presigned URL for any http method of your choice.
// Expires maximum in 7days - i.e 604800 and minimum in 1.
Copy link
Contributor

Choose a reason for hiding this comment

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

Expires maximum in 7days -> Expires maximum is 7 days.

@harshavardhana
Copy link
Member Author

Can you guys review again @vadmeste @poornas ?

api-presigned.go Outdated
// Expires maximum is 7days - ie. 604800 and minimum is 1.
// PresignedPutObject - Returns a presigned URL to upload an object
// without credentials. URL can have a maximum expiry of upto 7days
// or a minimum of 1sec, if expiry duration is set to 0 URL a
Copy link
Member

Choose a reason for hiding this comment

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

I didn't test it but after reading the code, it seems setting 0 to expires returns an error (invoked by isValidExpiry() in presignURL())

Copy link
Member Author

Choose a reason for hiding this comment

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

I see looks like behavior has changed.. @vadmeste - let me change the comment to reflect the new changes.

api-presigned.go Outdated
// headers using the query parameters.
// data without credentials. URL can have a maximum expiry of
// upto 7days or a minimum of 1sec, if expiry duration is set to 0
// URL a maximum value of 7 days is automatically choosen. Additionally
Copy link
Contributor

Choose a reason for hiding this comment

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

+// upto 7days or a minimum of 1sec, if expiry duration is set to 0
+// URL a maximum value of 7 days is automatically choosen.

Should be:
+// upto 7days or a minimum of 1sec, if expiry duration is set to 0
+// URL a maximum value of 7 days is automatically choosen.

Ditto for the other 3 function header comments

Copy link
Contributor

@poornas poornas left a comment

Choose a reason for hiding this comment

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

LGTM

@harshavardhana
Copy link
Member Author

@vadmeste waiting on your review.

Copy link
Member

@vadmeste vadmeste left a comment

Choose a reason for hiding this comment

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

LGTM

@deekoder deekoder merged commit e7255df into minio:master Aug 29, 2017
@harshavardhana harshavardhana deleted the dmage branch August 29, 2017 19:09
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.

4 participants