]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: send 100-continue response only if requested
authorYehuda Sadeh <yehuda@hq.newdream.net>
Mon, 27 Sep 2010 16:37:07 +0000 (09:37 -0700)
committerYehuda Sadeh <yehuda@hq.newdream.net>
Mon, 27 Sep 2010 17:01:47 +0000 (10:01 -0700)
src/rgw/rgw_common.h
src/rgw/rgw_main.cc
src/rgw/rgw_op.cc
src/rgw/rgw_rest.cc
src/rgw/rgw_rest.h

index 1d678f51c6897929b3cc2cbaed6f8f69bd11af30..e8c8918eb394de75729e380922c56c278985e87a 100644 (file)
@@ -164,6 +164,7 @@ struct req_state {
    const char *content_type;
    bool err_exist;
    struct rgw_err err;
+   bool expect_cont;
 
    XMLArgs args;
 
index 08ac3c55bde065de98746fbd428dbf02ed71e1ad..ff8699d249c59bb269a3b0605fcfa438173fb128 100644 (file)
@@ -275,7 +275,8 @@ int main(int argc, char *argv[])
       abort_early(&s, ret);
       continue;
     }
-    dump_continue(&s);
+    if (s.expect_cont)
+      dump_continue(&s);
 
     RGWOp *op = rgwhandler.get_op();
     if (op) {
index dd2236542fbcbe61ea666454e846bb0fdcd5c3f0..2e1784618a5f79cea4baef4862a6e95b549edf24 100644 (file)
@@ -712,6 +712,7 @@ void RGWHandler::init_state(struct req_state *s, struct fcgx_state *fcgx)
      s->acl = new RGWAccessControlPolicy;
   }
   s->canned_acl.clear();
+  s->expect_cont = false;
 
   provider_init_state();
 }
index c5dfc5e9f0bb3c41b8c0c703d6ad56b8df78a284..d7e0860f07761f5742190bb1f431ff68592ec18b 100644 (file)
@@ -648,6 +648,9 @@ void RGWHandler_REST::provider_init_state()
 
   s->copy_source = FCGX_GetParam("HTTP_X_AMZ_COPY_SOURCE", s->fcgx->envp);
   s->http_auth = FCGX_GetParam("HTTP_AUTHORIZATION", s->fcgx->envp);
+
+  const char *expect = FCGX_GetParam("HTTP_EXPECT", s->fcgx->envp);
+  s->expect_cont = (expect && !strcasecmp(expect, "100-continue"));
 }
 
 static bool is_acl_op(struct req_state *s)
index 8fe09498e4105429752a1ccbe11bbecf18d13aa5..ea49e67e40073008182452d287f393f86b1002e1 100644 (file)
@@ -115,6 +115,8 @@ class RGWHandler_REST : public RGWHandler {
   RGWOp *get_create_op(struct req_state *s);
   RGWOp *get_delete_op(struct req_state *s);
 
+  bool expect100cont;
+
 protected:
   void provider_init_state();
 public: