Merge lp:~andychilton/goamz/s3-fix-for-r60 into lp:~niemeyer/goamz/s3

Proposed by Andrew Chilton
Status: Merged
Merged at revision: 34
Proposed branch: lp:~andychilton/goamz/s3-fix-for-r60
Merge into: lp:~niemeyer/goamz/s3
Diff against target: 85 lines (+9/-9)
3 files modified
s3.go (+7/-6)
sign.go (+0/-1)
suite_test.go (+2/-2)
To merge this branch: bzr merge lp:~andychilton/goamz/s3-fix-for-r60
Reviewer Review Type Date Requested Status
Gustavo Niemeyer Pending
Review via email: mp+74881@code.launchpad.net

Description of the change

Fix for the new url package in r60.

To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 's3.go'
2--- s3.go 2011-06-25 00:49:24 +0000
3+++ s3.go 2011-09-10 05:52:22 +0000
4@@ -18,6 +18,7 @@
5 "strconv"
6 "strings"
7 "time"
8+ "url"
9 "xml"
10 )
11
12@@ -122,8 +123,8 @@
13 // ----------------------------------------------------------------------------
14 // Request dispatching logic.
15
16-func (s3 *S3) query(method, bucket, path string, params http.Values, headers http.Header, body io.Reader, resp interface{}) (hresp *http.Response, err os.Error) {
17- url, err := http.ParseURL(s3.Region.S3Endpoint)
18+func (s3 *S3) query(method, bucket, path string, params url.Values, headers http.Header, body io.Reader, resp interface{}) (hresp *http.Response, err os.Error) {
19+ endpoint, err := url.Parse(s3.Region.S3Endpoint)
20 if err != nil {
21 return nil, err
22 }
23@@ -139,17 +140,17 @@
24 if headers == nil {
25 headers = map[string][]string{}
26 }
27- headers["Host"] = []string{url.Host}
28+ headers["Host"] = []string{endpoint.Host}
29 headers["Date"] = []string{time.UTC().Format(time.RFC1123)}
30 sign(s3.Auth, method, path, params, headers)
31
32- url.Path = path
33+ endpoint.Path = path
34 if len(params) > 0 {
35- url.RawQuery = params.Encode()
36+ endpoint.RawQuery = params.Encode()
37 }
38
39 req := http.Request{
40- URL: url,
41+ URL: endpoint,
42 Method: method,
43 ProtoMajor: 1,
44 ProtoMinor: 1,
45
46=== modified file 'sign.go'
47--- sign.go 2011-08-03 01:33:34 +0000
48+++ sign.go 2011-09-10 05:52:22 +0000
49@@ -10,7 +10,6 @@
50
51 var b64 = base64.StdEncoding
52
53-
54 // ----------------------------------------------------------------------------
55 // S3 signing (http://goo.gl/G1LrK)
56
57
58=== modified file 'suite_test.go'
59--- suite_test.go 2011-06-25 00:49:24 +0000
60+++ suite_test.go 2011-09-10 05:52:22 +0000
61@@ -9,6 +9,7 @@
62 "os"
63 "testing"
64 "time"
65+ "url"
66 )
67
68 func Test(t *testing.T) {
69@@ -36,7 +37,6 @@
70
71 var testServer = NewTestHTTPServer("http://localhost:4444", 5e9)
72
73-
74 func (s *HTTPSuite) SetUpSuite(c *C) {
75 testServer.Start()
76 }
77@@ -74,7 +74,7 @@
78 s.response = make(chan *testResponse, 64)
79 s.pending = make(chan bool, 64)
80
81- url, _ := http.ParseURL(s.URL)
82+ url, _ := url.Parse(s.URL)
83 go http.ListenAndServe(url.Host, s)
84
85 s.PrepareResponse(202, nil, "Nothing.")

Subscribers

People subscribed via source and target branches