[ARVADOS] created: e94da792a8fc562bc35e63b6ff5b2f87822d2755
git at public.curoverse.com
git at public.curoverse.com
Thu Apr 30 13:59:35 EDT 2015
at e94da792a8fc562bc35e63b6ff5b2f87822d2755 (commit)
commit e94da792a8fc562bc35e63b6ff5b2f87822d2755
Author: Peter Amstutz <peter.amstutz at curoverse.com>
Date: Thu Apr 30 13:59:22 2015 -0400
Return error if Content-Length header is missing instead of panicing.
diff --git a/services/keepstore/handlers.go b/services/keepstore/handlers.go
index f462b0a..b64294f 100644
--- a/services/keepstore/handlers.go
+++ b/services/keepstore/handlers.go
@@ -160,6 +160,11 @@ func PutBlockHandler(resp http.ResponseWriter, req *http.Request) {
// the body: avoid transmitting data that will not end up
// being written anyway.
+ if req.ContentLength == -1 {
+ http.Error(resp, SizeRequiredError.Error(), SizeRequiredError.HTTPCode)
+ return
+ }
+
if req.ContentLength > BLOCKSIZE {
http.Error(resp, TooLongError.Error(), TooLongError.HTTPCode)
return
diff --git a/services/keepstore/keepstore.go b/services/keepstore/keepstore.go
index 5333625..401d66f 100644
--- a/services/keepstore/keepstore.go
+++ b/services/keepstore/keepstore.go
@@ -75,7 +75,8 @@ var (
NotFoundError = &KeepError{404, "Not Found"}
GenericError = &KeepError{500, "Fail"}
FullError = &KeepError{503, "Full"}
- TooLongError = &KeepError{504, "Timeout"}
+ SizeRequiredError = &KeepError{411, "Missing Content-Length"}
+ TooLongError = &KeepError{413, "Block is too large"}
MethodDisabledError = &KeepError{405, "Method disabled"}
)
@@ -109,6 +110,7 @@ var (
flagSerializeIO bool
flagReadonly bool
)
+
type volumeSet []Volume
func (vs *volumeSet) Set(value string) error {
-----------------------------------------------------------------------
hooks/post-receive
--
More information about the arvados-commits
mailing list