forked from TrueCloudLab/rclone
vendor: pull in github.com/ncw/swift latest to fix reauth on big files
This commit is contained in:
parent
1c01d0b84a
commit
039e2a9649
7 changed files with 50 additions and 5 deletions
2
vendor/github.com/ncw/swift/README.md
generated
vendored
2
vendor/github.com/ncw/swift/README.md
generated
vendored
|
@ -150,3 +150,5 @@ Contributors
|
|||
- Arthur Paim Arnold <arthurpaimarnold@gmail.com>
|
||||
- Bruno Michel <bmichel@menfin.info>
|
||||
- Charles Hsu <charles0126@gmail.com>
|
||||
- Omar Ali <omarali@users.noreply.github.com>
|
||||
- Andreas Andersen <andreas@softwaredesign.se>
|
||||
|
|
21
vendor/github.com/ncw/swift/compatibility_1_6.go
generated
vendored
Normal file
21
vendor/github.com/ncw/swift/compatibility_1_6.go
generated
vendored
Normal file
|
@ -0,0 +1,21 @@
|
|||
// +build go1.6
|
||||
|
||||
package swift
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
"time"
|
||||
)
|
||||
|
||||
const IS_AT_LEAST_GO_16 = true
|
||||
|
||||
func SetExpectContinueTimeout(tr *http.Transport, t time.Duration) {
|
||||
tr.ExpectContinueTimeout = t
|
||||
}
|
||||
|
||||
func AddExpectAndTransferEncoding(req *http.Request, hasContentLength bool) {
|
||||
req.Header.Add("Expect", "100-continue")
|
||||
if !hasContentLength {
|
||||
req.TransferEncoding = []string{"chunked"}
|
||||
}
|
||||
}
|
13
vendor/github.com/ncw/swift/compatibility_not_1_6.go
generated
vendored
Normal file
13
vendor/github.com/ncw/swift/compatibility_not_1_6.go
generated
vendored
Normal file
|
@ -0,0 +1,13 @@
|
|||
// +build !go1.6
|
||||
|
||||
package swift
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
"time"
|
||||
)
|
||||
|
||||
const IS_AT_LEAST_GO_16 = false
|
||||
|
||||
func SetExpectContinueTimeout(tr *http.Transport, t time.Duration) {}
|
||||
func AddExpectAndTransferEncoding(req *http.Request, hasContentLength bool) {}
|
13
vendor/github.com/ncw/swift/swift.go
generated
vendored
13
vendor/github.com/ncw/swift/swift.go
generated
vendored
|
@ -423,12 +423,15 @@ func (c *Connection) setDefaults() {
|
|||
c.Timeout = 60 * time.Second
|
||||
}
|
||||
if c.Transport == nil {
|
||||
c.Transport = &http.Transport{
|
||||
t := &http.Transport{
|
||||
// TLSClientConfig: &tls.Config{RootCAs: pool},
|
||||
// DisableCompression: true,
|
||||
Proxy: http.ProxyFromEnvironment,
|
||||
MaxIdleConnsPerHost: 2048,
|
||||
Proxy: http.ProxyFromEnvironment,
|
||||
// Half of linux's default open files limit (1024).
|
||||
MaxIdleConnsPerHost: 512,
|
||||
}
|
||||
SetExpectContinueTimeout(t, 5*time.Second)
|
||||
c.Transport = t
|
||||
}
|
||||
if c.client == nil {
|
||||
c.client = &http.Client{
|
||||
|
@ -720,6 +723,10 @@ 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)
|
||||
|
||||
_, hasCL := p.Headers["Content-Length"]
|
||||
AddExpectAndTransferEncoding(req, hasCL)
|
||||
|
||||
resp, err = c.doTimeoutRequest(timer, req)
|
||||
if err != nil {
|
||||
if (p.Operation == "HEAD" || p.Operation == "GET") && retries > 0 {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue