From 552b11e28d874c84c278fbaf2dd4cc24c326daa7 Mon Sep 17 00:00:00 2001 From: Andrey Smirnov Date: Wed, 5 Nov 2014 02:46:01 +0300 Subject: [PATCH] Workaround for '+' escaping in Amazon S3. #130 --- http/download.go | 10 +++++++++- system/t04_mirror/CreateMirror20Test_gold | 2 +- system/t04_mirror/CreateMirror21Test_mirror_show | 2 +- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/http/download.go b/http/download.go index e7167945..112e0d75 100644 --- a/http/download.go +++ b/http/download.go @@ -140,7 +140,15 @@ func (downloader *downloaderImpl) DownloadWithChecksum(url string, destination s func (downloader *downloaderImpl) handleTask(task *downloadTask) { downloader.progress.Printf("Downloading %s...\n", task.url) - resp, err := downloader.client.Get(task.url) + req, err := http.NewRequest("GET", task.url, nil) + if err != nil { + task.result <- fmt.Errorf("%s: %s", task.url, err) + return + } + + req.URL.Opaque = strings.Replace(req.URL.RequestURI(), "+", "%2b", -1) + + resp, err := downloader.client.Do(req) if err != nil { task.result <- fmt.Errorf("%s: %s", task.url, err) return diff --git a/system/t04_mirror/CreateMirror20Test_gold b/system/t04_mirror/CreateMirror20Test_gold index 053cfec4..5d4a4d6f 100644 --- a/system/t04_mirror/CreateMirror20Test_gold +++ b/system/t04_mirror/CreateMirror20Test_gold @@ -1,3 +1,3 @@ Downloading http://security.debian.org/dists/wheezy/updates/InRelease... Downloading http://security.debian.org/dists/wheezy/updates/Release... -ERROR: unable to fetch mirror: http://security.debian.org/dists/wheezy/updates/Release: Get http://security.debian.org/dists/wheezy/updates/Release: http: error connecting to proxy http://127.0.0.1:3137: dial tcp 127.0.0.1:3137: connection refused +ERROR: unable to fetch mirror: http://security.debian.org/dists/wheezy/updates/Release: Get http:/dists/wheezy/updates/Release: http: error connecting to proxy http://127.0.0.1:3137: dial tcp 127.0.0.1:3137: connection refused diff --git a/system/t04_mirror/CreateMirror21Test_mirror_show b/system/t04_mirror/CreateMirror21Test_mirror_show index 385432d3..7fca4dd3 100644 --- a/system/t04_mirror/CreateMirror21Test_mirror_show +++ b/system/t04_mirror/CreateMirror21Test_mirror_show @@ -9,6 +9,6 @@ Last update: never Information from release file: Architectures: all -Date: Wed, 01 Oct 2014 18:30:34 UTC +Date: Thu, 30 Oct 2014 04:25:46 UTC Origin: jenkins-ci.org Suite: binary