]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
Handle empty CONTENT_LENGTH environment variable. 67/head
authorJan Harkes <jaharkes@cs.cmu.edu>
Mon, 18 Feb 2013 21:15:36 +0000 (16:15 -0500)
committerJan Harkes <jaharkes@cs.cmu.edu>
Thu, 21 Feb 2013 20:36:30 +0000 (15:36 -0500)
nginx seems to be providing a CONTENT_LENGTH environment variable with no data
when the request body is empty.

Signed-off-by: Jan Harkes <jaharkes@cs.cmu.edu>
src/rgw/rgw_rest.cc

index ab3927e7a627b0e94ada2d3dfdfda5e57a6f111e..363feac56c1f47fd941b4112297c69a8772a3a54 100644 (file)
@@ -1164,8 +1164,9 @@ int RGWREST::preprocess(struct req_state *s, RGWClientIO *cio)
   s->length = s->env->get("CONTENT_LENGTH");
   if (s->length) {
     if (*s->length == '\0')
-      return -EINVAL;
-    s->content_length = atoll(s->length);
+      s->content_length = 0;
+    else
+      s->content_length = atoll(s->length);
   }
 
   map<string, string>::iterator giter;