Merge lp:~songofacandy/goamz/s3head into lp:goamz

Proposed by methane
Status: Needs review
Proposed branch: lp:~songofacandy/goamz/s3head
Merge into: lp:goamz
Diff against target: 34 lines (+24/-0)
1 file modified
s3/s3.go (+24/-0)
To merge this branch: bzr merge lp:~songofacandy/goamz/s3head
Reviewer Review Type Date Requested Status
goamz maintainers Pending
Review via email: mp+155093@code.launchpad.net
To post a comment you must log in.

Unmerged revisions

36. By methane

s3: Support HEAD request.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 's3/s3.go'
--- s3/s3.go 2013-02-11 17:15:59 +0000
+++ s3/s3.go 2013-03-23 08:19:21 +0000
@@ -168,6 +168,30 @@
168 panic("unreachable")168 panic("unreachable")
169}169}
170170
171// Exists checks an object is on S3 bucket with HEAD request.
172func (b *Bucket) Exists(path string) (exists bool, err error) {
173 req := &request{
174 method: "HEAD",
175 bucket: b.Name,
176 path: path,
177 }
178 err = b.S3.prepare(req)
179 if err != nil {
180 return
181 }
182 for attempt := attempts.Start(); attempt.Next(); {
183 resp, err := b.S3.run(req, nil)
184 if shouldRetry(err) && attempt.HasNext() {
185 continue
186 }
187 if resp.StatusCode/100 == 2 {
188 exists = true
189 }
190 return exists, err
191 }
192 panic("unreachable")
193}
194
171// Put inserts an object into the S3 bucket.195// Put inserts an object into the S3 bucket.
172//196//
173// See http://goo.gl/FEBPD for details.197// See http://goo.gl/FEBPD for details.

Subscribers

People subscribed via source and target branches

to all changes: