From 2cbb72c2d008a5c7b3eac03836d5627f703ff481 Mon Sep 17 00:00:00 2001 From: Gilbert Chen Date: Tue, 4 Jul 2017 15:14:15 -0400 Subject: [PATCH] Handle 3xx status codes from B2 --- src/duplicacy_b2client.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/duplicacy_b2client.go b/src/duplicacy_b2client.go index 29f9cd6..7526f85 100644 --- a/src/duplicacy_b2client.go +++ b/src/duplicacy_b2client.go @@ -135,7 +135,7 @@ func (client *B2Client) call(url string, input interface{}) (io.ReadCloser, int6 return nil, 0, err } - if response.StatusCode < 400 { + if response.StatusCode < 300 { return response.Body, response.ContentLength, nil } @@ -160,6 +160,10 @@ func (client *B2Client) call(url string, input interface{}) (io.ReadCloser, int6 } else if response.StatusCode >= 500 && response.StatusCode <= 599 { backoff = client.retry(backoff, response) continue + } else { + LOG_INFO("BACKBLAZE_CALL", "URL request '%s' returned status code %d", url, response.StatusCode) + backoff = client.retry(backoff, response) + continue } defer response.Body.Close() @@ -487,7 +491,7 @@ func (client *B2Client) UploadFile(filePath string, content []byte, rateLimit in io.Copy(ioutil.Discard, response.Body) response.Body.Close() - if response.StatusCode < 400 { + if response.StatusCode < 300 { return nil }