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

This commit is contained in:
Nick Craig-Wood
2019-03-25 13:41:34 +00:00
parent 2065e73d0b
commit b0380aad95
5 changed files with 17 additions and 12 deletions
+3 -1
View File
@@ -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"}
}
+10 -9
View File
@@ -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,
}
}
if err = c.parseHeaders(resp, p.ErrorMap); err != nil {
return nil, nil, err
}
headers = readHeaders(resp)
if err = c.parseHeaders(resp, p.ErrorMap); err != nil {
return
}
if p.NoResponse {
var err error
drainAndClose(resp.Body, &err)
if err != nil {
return nil, nil, err
return
}
} else {
// Cancel the request on timeout
+1 -1
View File
@@ -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