Skip to content

"rsync for cloud storage" - Google Drive, S3, Dropbox, Backblaze B2, One Drive, Swift, Hubic, Wasabi, Google Cloud Storage, Azure Blob, Azure Files, Yandex Files

vendor: update github.com/ncw/swift to help with #3041

Nick Craig-Woodb0380aad9508
diff --git a/go.mod b/go.mod
index f2334c005..fdd7e28cb 100644
--- a/go.mod
+++ b/go.mod
@@ -28,7 +28,7 @@ require (
github.com/kr/fs v0.1.0 // indirect
github.com/mattn/go-runewidth v0.0.4
github.com/ncw/go-acd v0.0.0-20171120105400-887eb06ab6a2
- github.com/ncw/swift v1.0.46
+ github.com/ncw/swift v1.0.47
github.com/nsf/termbox-go v0.0.0-20190121233118-02980233997d
github.com/okzk/sdnotify v0.0.0-20180710141335-d9becc38acbd
github.com/patrickmn/go-cache v2.1.0+incompatible
diff --git a/go.sum b/go.sum
index 6052331e5..5091d3adc 100644
--- a/go.sum
+++ b/go.sum
@@ -111,6 +111,8 @@ github.com/ncw/swift v1.0.44 h1:EKvOTvUxElbpDWqxsyVaVGvc2IfuOqQnRmjnR2AGhQ4=
github.com/ncw/swift v1.0.44/go.mod h1:23YIA4yWVnGwv2dQlN4bB7egfYX6YLn0Yo/S6zZO/ZM=
github.com/ncw/swift v1.0.46 h1:ewnoFKEI9f2LT+gqmeeiJ1SCzOBDTcK3JF1XziR85QQ=
github.com/ncw/swift v1.0.46/go.mod h1:23YIA4yWVnGwv2dQlN4bB7egfYX6YLn0Yo/S6zZO/ZM=
+github.com/ncw/swift v1.0.47 h1:4DQRPj35Y41WogBxyhOXlrI37nzGlyEcsforeudyYPQ=
+github.com/ncw/swift v1.0.47/go.mod h1:23YIA4yWVnGwv2dQlN4bB7egfYX6YLn0Yo/S6zZO/ZM=
github.com/neelance/astrewrite v0.0.0-20160511093645-99348263ae86/go.mod h1:kHJEU3ofeGjhHklVoIGuVj85JJwZ6kWPaJwCIxgnFmo=
github.com/neelance/sourcemap v0.0.0-20151028013722-8c68805598ab/go.mod h1:Qr6/a/Q4r9LP1IltGz7tA7iOK1WonHEYhu1HRBA7ZiM=
github.com/nsf/termbox-go v0.0.0-20190121233118-02980233997d h1:x3S6kxmy49zXVVyhcnrFqxvNVCBPb2KZ9hV2RBdS840=
diff --git a/vendor/github.com/ncw/swift/compatibility_1_6.go b/vendor/github.com/ncw/swift/compatibility_1_6.go
index 030cbc446..b443d01d2 100644
--- a/vendor/github.com/ncw/swift/compatibility_1_6.go
+++ b/vendor/github.com/ncw/swift/compatibility_1_6.go
@@ -14,7 +14,9 @@ func SetExpectContinueTimeout(tr *http.Transport, t time.Duration) {
}
func AddExpectAndTransferEncoding(req *http.Request, hasContentLength bool) {
- req.Header.Add("Expect", "100-continue")
+ if req.Body != nil {
+ req.Header.Add("Expect", "100-continue")
+ }
if !hasContentLength {
req.TransferEncoding = []string{"chunked"}
}
diff --git a/vendor/github.com/ncw/swift/swift.go b/vendor/github.com/ncw/swift/swift.go
index f197dddea..72ede2493 100644
--- a/vendor/github.com/ncw/swift/swift.go
+++ b/vendor/github.com/ncw/swift/swift.go
@@ -308,6 +308,7 @@ var (
Forbidden = newError(403, "Operation forbidden")
TooLargeObject = newError(413, "Too Large Object")
RateLimit = newError(498, "Rate Limit")
+ TooManyRequests = newError(429, "TooManyRequests")
// Mappings for authentication errors
authErrorMap = errorMap{
@@ -333,6 +334,7 @@ var (
404: ObjectNotFound,
413: TooLargeObject,
422: ObjectCorrupted,
+ 429: TooManyRequests,
498: RateLimit,
}
)
@@ -734,11 +736,11 @@ func (c *Connection) Call(targetUrl string, p RequestOpts) (resp *http.Response,
for k, v := range p.Headers {
// Set ContentLength in req if the user passed it in in the headers
if k == "Content-Length" {
- contentLength, err := strconv.ParseInt(v, 10, 64)
+ req.ContentLength, err = strconv.ParseInt(v, 10, 64)
if err != nil {
- return nil, nil, fmt.Errorf("Invalid %q header %q: %v", k, v, err)
+ err = fmt.Errorf("Invalid %q header %q: %v", k, v, err)
+ return
}
- req.ContentLength = contentLength
} else {
req.Header.Add(k, v)
}
@@ -756,7 +758,7 @@ func (c *Connection) Call(targetUrl string, p RequestOpts) (resp *http.Response,
retries--
continue
}
- return nil, nil, err
+ return
}
// Check to see if token has expired
if resp.StatusCode == 401 && retries > 0 {
@@ -768,15 +770,14 @@ func (c *Connection) Call(targetUrl string, p RequestOpts) (resp *http.Response,
}
}
+ headers = readHeaders(resp)
if err = c.parseHeaders(resp, p.ErrorMap); err != nil {
- return nil, nil, err
+ return
}
- headers = readHeaders(resp)
if p.NoResponse {
- var err error
drainAndClose(resp.Body, &err)
if err != nil {
- return nil, nil, err
+ return
}
} else {
// Cancel the request on timeout
diff --git a/vendor/modules.txt b/vendor/modules.txt
index 65f3ce802..9c953bea2 100644
--- a/vendor/modules.txt
+++ b/vendor/modules.txt
@@ -108,7 +108,7 @@ github.com/kr/fs
github.com/mattn/go-runewidth
# github.com/ncw/go-acd v0.0.0-20171120105400-887eb06ab6a2
github.com/ncw/go-acd
-# github.com/ncw/swift v1.0.46
+# github.com/ncw/swift v1.0.47
github.com/ncw/swift
# github.com/nsf/termbox-go v0.0.0-20190121233118-02980233997d
github.com/nsf/termbox-go