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

s3-about
Nick Craig-Wood 2019-03-19 13:27:46 +00:00
parent 2065e73d0b
commit b0380aad95
5 changed files with 17 additions and 12 deletions

2
go.mod
View File

@ -28,7 +28,7 @@ require (
github.com/kr/fs v0.1.0 // indirect github.com/kr/fs v0.1.0 // indirect
github.com/mattn/go-runewidth v0.0.4 github.com/mattn/go-runewidth v0.0.4
github.com/ncw/go-acd v0.0.0-20171120105400-887eb06ab6a2 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/nsf/termbox-go v0.0.0-20190121233118-02980233997d
github.com/okzk/sdnotify v0.0.0-20180710141335-d9becc38acbd github.com/okzk/sdnotify v0.0.0-20180710141335-d9becc38acbd
github.com/patrickmn/go-cache v2.1.0+incompatible github.com/patrickmn/go-cache v2.1.0+incompatible

2
go.sum
View File

@ -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.44/go.mod h1:23YIA4yWVnGwv2dQlN4bB7egfYX6YLn0Yo/S6zZO/ZM=
github.com/ncw/swift v1.0.46 h1:ewnoFKEI9f2LT+gqmeeiJ1SCzOBDTcK3JF1XziR85QQ= 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.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/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/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= github.com/nsf/termbox-go v0.0.0-20190121233118-02980233997d h1:x3S6kxmy49zXVVyhcnrFqxvNVCBPb2KZ9hV2RBdS840=

View File

@ -14,7 +14,9 @@ func SetExpectContinueTimeout(tr *http.Transport, t time.Duration) {
} }
func AddExpectAndTransferEncoding(req *http.Request, hasContentLength bool) { 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 { if !hasContentLength {
req.TransferEncoding = []string{"chunked"} req.TransferEncoding = []string{"chunked"}
} }

19
vendor/github.com/ncw/swift/swift.go generated vendored
View File

@ -308,6 +308,7 @@ var (
Forbidden = newError(403, "Operation forbidden") Forbidden = newError(403, "Operation forbidden")
TooLargeObject = newError(413, "Too Large Object") TooLargeObject = newError(413, "Too Large Object")
RateLimit = newError(498, "Rate Limit") RateLimit = newError(498, "Rate Limit")
TooManyRequests = newError(429, "TooManyRequests")
// Mappings for authentication errors // Mappings for authentication errors
authErrorMap = errorMap{ authErrorMap = errorMap{
@ -333,6 +334,7 @@ var (
404: ObjectNotFound, 404: ObjectNotFound,
413: TooLargeObject, 413: TooLargeObject,
422: ObjectCorrupted, 422: ObjectCorrupted,
429: TooManyRequests,
498: RateLimit, 498: RateLimit,
} }
) )
@ -734,11 +736,11 @@ func (c *Connection) Call(targetUrl string, p RequestOpts) (resp *http.Response,
for k, v := range p.Headers { for k, v := range p.Headers {
// Set ContentLength in req if the user passed it in in the headers // Set ContentLength in req if the user passed it in in the headers
if k == "Content-Length" { if k == "Content-Length" {
contentLength, err := strconv.ParseInt(v, 10, 64) req.ContentLength, err = strconv.ParseInt(v, 10, 64)
if err != nil { 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 { } else {
req.Header.Add(k, v) req.Header.Add(k, v)
} }
@ -756,7 +758,7 @@ func (c *Connection) Call(targetUrl string, p RequestOpts) (resp *http.Response,
retries-- retries--
continue continue
} }
return nil, nil, err return
} }
// Check to see if token has expired // Check to see if token has expired
if resp.StatusCode == 401 && retries > 0 { if resp.StatusCode == 401 && retries > 0 {
@ -768,15 +770,14 @@ func (c *Connection) Call(targetUrl string, p RequestOpts) (resp *http.Response,
} }
} }
if err = c.parseHeaders(resp, p.ErrorMap); err != nil {
return nil, nil, err
}
headers = readHeaders(resp) headers = readHeaders(resp)
if err = c.parseHeaders(resp, p.ErrorMap); err != nil {
return
}
if p.NoResponse { if p.NoResponse {
var err error
drainAndClose(resp.Body, &err) drainAndClose(resp.Body, &err)
if err != nil { if err != nil {
return nil, nil, err return
} }
} else { } else {
// Cancel the request on timeout // Cancel the request on timeout

2
vendor/modules.txt vendored
View File

@ -108,7 +108,7 @@ github.com/kr/fs
github.com/mattn/go-runewidth github.com/mattn/go-runewidth
# github.com/ncw/go-acd v0.0.0-20171120105400-887eb06ab6a2 # github.com/ncw/go-acd v0.0.0-20171120105400-887eb06ab6a2
github.com/ncw/go-acd 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/ncw/swift
# github.com/nsf/termbox-go v0.0.0-20190121233118-02980233997d # github.com/nsf/termbox-go v0.0.0-20190121233118-02980233997d
github.com/nsf/termbox-go github.com/nsf/termbox-go