"rsync for cloud storage" - Google Drive, S3, Dropbox, Backblaze B2, One Drive, Swift, Hubic, Wasabi, Google Cloud Storage, Azure Blob, Azure Files, Yandex Files
Go azure-blobazure-blob-storageazure-filesbackblaze-b2cloud-storagedropboxencryptionftpfuse-filesystemgogolanggoogle-cloud-storagegoogle-driveonedriveopenstack-swiftrclones3sftpsyncwebdav
Fix incorrect vendoring for swift library
Nick Craig-Wood5c89fd679df6
diff --git a/Godeps/Godeps.json b/Godeps/Godeps.jsonindex ef5efdf03..dfba9a850 100644--- a/Godeps/Godeps.json+++ b/Godeps/Godeps.json@@ -213,7 +213,7 @@},{"ImportPath": "github.com/ncw/swift",- "Rev": "95fc38e8de85903f4bf5b8d62721f0b9e106747a"+ "Rev": "6c1b1510538e1f00d49a558b7b9b87d71bc454d6"},{"ImportPath": "github.com/pkg/errors",diff --git a/vendor/github.com/ncw/swift/expect_continue.go b/vendor/github.com/ncw/swift/expect_continue.godeleted file mode 100644index 0e9e4a1ef..000000000--- a/vendor/github.com/ncw/swift/expect_continue.go+++ /dev/null@@ -1,22 +0,0 @@-// Show that we can use `Expect: 100-continue` in go versions >= 1.6-//-// +build go1.6--package swift--import (- "net/http"- "time"-)--// DisableExpectContinue indicates whether this version of go supports-// expect continue.-const DisableExpectContinue = false--// SetExpectContinueTimeout sets ExpectContinueTimeout in the-// transport to the default value if not set.-func SetExpectContinueTimeout(transport *http.Transport, t time.Duration) {- if transport.ExpectContinueTimeout == 0 {- transport.ExpectContinueTimeout = t- }-}diff --git a/vendor/github.com/ncw/swift/expect_continue_pre1_6.go b/vendor/github.com/ncw/swift/expect_continue_pre1_6.godeleted file mode 100644index 74f05494f..000000000--- a/vendor/github.com/ncw/swift/expect_continue_pre1_6.go+++ /dev/null@@ -1,20 +0,0 @@-// Show that we can't use `Expect: 100-continue` in go versions < 1.6-//-// +build !go1.6--package swift--import (- "net/http"- "time"-)--// DisableExpectContinue indicates whether this version of go supports-// expect continue.-const DisableExpectContinue = true--// SetExpectContinueTimeout sets ExpectContinueTimeout in the-// transport to the default value if not set.-func SetExpectContinueTimeout(transport *http.Transport, t time.Duration) {- // can't do anything so ignore-}diff --git a/vendor/github.com/ncw/swift/swift.go b/vendor/github.com/ncw/swift/swift.goindex 2328b16c4..e463f93d7 100644--- a/vendor/github.com/ncw/swift/swift.go+++ b/vendor/github.com/ncw/swift/swift.go@@ -102,13 +102,6 @@ type Connection struct {TenantDomainId string // Id of the tenant's domain (v3 auth only), only needed if it differs the from user domainTrustId string // Id of the trust (v3 auth only)Transport http.RoundTripper `json:"-" xml:"-"` // Optional specialised http.Transport (eg. for Google Appengine)- // If set then we won't send `Expect: 100-continue` headers.- // This is automatically disabled on go < 1.6 which doesn't- // support it and if a 417 error is received. Note that if- // you are using a custom Transport and you wish the `Expect:- // 100-continue` mechanism to work, you'll need to set- // ExpectContinueTimeout to a non-zero value.- DisableExpectContinue bool// These are filled in after Authenticate is called as are the defaults for aboveStorageUrl stringAuthToken string@@ -156,7 +149,6 @@ var (TimeoutError = newError(408, "Timeout when reading or writing data")Forbidden = newError(403, "Operation forbidden")TooLargeObject = newError(413, "Too Large Object")- RetryNeeded = newError(401, "Retry needed after token expired")// Mappings for authentication errorsauthErrorMap = errorMap{@@ -262,17 +254,12 @@ func (c *Connection) setDefaults() {c.Timeout = 60 * time.Second}if c.Transport == nil {- tr := &http.Transport{+ c.Transport = &http.Transport{// TLSClientConfig: &tls.Config{RootCAs: pool},// DisableCompression: true,Proxy: http.ProxyFromEnvironment,MaxIdleConnsPerHost: 2048,}- // If using ExpectContinue make sure it is set in the transport- if !c.DisableExpectContinue {- SetExpectContinueTimeout(tr, 5*time.Second)- }- c.Transport = tr}if c.client == nil {c.client = &http.Client{@@ -476,13 +463,6 @@ func (c *Connection) Call(targetUrl string, p RequestOpts) (resp *http.Response,if retries == 0 {retries = c.Retries}- reader := p.Body- var wdReader *watchdogReader- timer := time.NewTimer(c.ConnectTimeout)- if reader != nil {- wdReader = newWatchdogReader(reader, c.Timeout, timer)- reader = wdReader- }var req *http.Requestfor {var authToken string@@ -503,6 +483,11 @@ func (c *Connection) Call(targetUrl string, p RequestOpts) (resp *http.Response,if p.Parameters != nil {URL.RawQuery = p.Parameters.Encode()}+ timer := time.NewTimer(c.ConnectTimeout)+ reader := p.Body+ if reader != nil {+ reader = newWatchdogReader(reader, c.Timeout, timer)+ }req, err = http.NewRequest(p.Operation, URL.String(), reader)if err != nil {return@@ -523,12 +508,6 @@ func (c *Connection) Call(targetUrl string, p RequestOpts) (resp *http.Response,}req.Header.Add("User-Agent", c.UserAgent)req.Header.Add("X-Auth-Token", authToken)- // Use `Expect: 100-continue` if body set and not disabled- usingExpectContinue := false- if !DisableExpectContinue && !c.DisableExpectContinue && p.Body != nil {- req.Header.Set("Expect", "100-continue")- usingExpectContinue = true- }resp, err = c.doTimeoutRequest(timer, req)if err != nil {if (p.Operation == "HEAD" || p.Operation == "GET") && retries > 0 {@@ -537,27 +516,14 @@ func (c *Connection) Call(targetUrl string, p RequestOpts) (resp *http.Response,}return nil, nil, err}- if retries <= 0 {- break- }- if resp.StatusCode == 417 && usingExpectContinue {- // Disable `Expect: 100-continue` if get 417 error in response- c.DisableExpectContinue = true- } else if resp.StatusCode == 401 {- // Token has expired+ // Check to see if token has expired+ if resp.StatusCode == 401 && retries > 0 {+ _ = resp.Body.Close()c.UnAuthenticate()- // If we were reading from a reader and we- // can't reset it, then fail here, otherwise- // retry.- if wdReader != nil && !wdReader.Reset() {- return resp, headers, RetryNeeded- }+ retries--} else {break}- // Retry- _ = resp.Body.Close()- retries--}if err = c.parseHeaders(resp, p.ErrorMap); err != nil {diff --git a/vendor/github.com/ncw/swift/watchdog_reader.go b/vendor/github.com/ncw/swift/watchdog_reader.goindex a8cae4360..b12b1bbe2 100644--- a/vendor/github.com/ncw/swift/watchdog_reader.go+++ b/vendor/github.com/ncw/swift/watchdog_reader.go@@ -7,18 +7,12 @@ import (// An io.Reader which resets a watchdog timer whenever data is readtype watchdogReader struct {- timeout time.Duration- reader io.Reader- timer *time.Timer- bytes int64- replayFirst bool- readFirst bool- first byte+ timeout time.Duration+ reader io.Reader+ timer *time.Timer}// Returns a new reader which will kick the watchdog timer whenever data is read-//-// It also has a 1 byte buffer which can be reset with the Reset() method.func newWatchdogReader(reader io.Reader, timeout time.Duration, timer *time.Timer) *watchdogReader {return &watchdogReader{timeout: timeout,@@ -29,43 +23,12 @@ func newWatchdogReader(reader io.Reader, timeout time.Duration, timer *time.Time// Read reads up to len(p) bytes into pfunc (t *watchdogReader) Read(p []byte) (n int, err error) {- if len(p) == 0 {- return 0, nil- }// FIXME limit the amount of data read in one chunk so as to not exceed the timeout?resetTimer(t.timer, t.timeout)- if t.replayFirst {- p[0] = t.first- t.replayFirst = false- n = 1- err = nil- } else {- n, err = t.reader.Read(p)- if !t.readFirst && n > 0 {- t.first = p[0]- t.readFirst = true- }- t.bytes += int64(n)- }+ n, err = t.reader.Read(p)resetTimer(t.timer, t.timeout)return}-// Resets the buffer if only 1 byte read-//-// Returns true if successful-func (t *watchdogReader) Reset() bool {- switch t.bytes {- case 0:- t.replayFirst = false- return true- case 1:- t.replayFirst = true- return true- default:- return false- }-}-// Check it satisfies the interfacevar _ io.Reader = &watchdogReader{}