projects
/
arvados.git
/ blobdiff
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge branch 'master' into 7492-keepproxy-upstream-errors
[arvados.git]
/
services
/
keepproxy
/
keepproxy.go
diff --git
a/services/keepproxy/keepproxy.go
b/services/keepproxy/keepproxy.go
index 7900096caf0ad9e80dfe13fde5970dbd0876db27..d3dbeaf89e420d4546d0fedab643d9b15e9849c9 100644
(file)
--- a/
services/keepproxy/keepproxy.go
+++ b/
services/keepproxy/keepproxy.go
@@
-362,7
+362,7
@@
func (this GetBlockHandler) ServeHTTP(resp http.ResponseWriter, req *http.Reques
log.Println("Warning:", GetRemoteAddress(req), req.Method, proxiedURI, "Content-Length not provided")
}
log.Println("Warning:", GetRemoteAddress(req), req.Method, proxiedURI, "Content-Length not provided")
}
- switch
err
{
+ switch
respErr := err.(type)
{
case nil:
status = http.StatusOK
resp.Header().Set("Content-Length", fmt.Sprint(expectLength))
case nil:
status = http.StatusOK
resp.Header().Set("Content-Length", fmt.Sprint(expectLength))
@@
-375,10
+375,16
@@
func (this GetBlockHandler) ServeHTTP(resp http.ResponseWriter, req *http.Reques
err = ContentLengthMismatch
}
}
err = ContentLengthMismatch
}
}
- case keepclient.BlockNotFound:
- status = http.StatusNotFound
+ case keepclient.Error:
+ if respErr == keepclient.BlockNotFound {
+ status = http.StatusNotFound
+ } else if respErr.Temporary() {
+ status = http.StatusBadGateway
+ } else {
+ status = 422
+ }
default:
default:
- status = http.Status
BadGateway
+ status = http.Status
InternalServerError
}
}
}
}