From 5a9a5e74df760e67129297a1d32b76c32b50f8b1 Mon Sep 17 00:00:00 2001 From: Yehuda Sadeh Date: Mon, 27 Sep 2010 09:37:07 -0700 Subject: [PATCH] rgw: send 100-continue response only if requested --- src/rgw/rgw_common.h | 1 + src/rgw/rgw_main.cc | 3 ++- src/rgw/rgw_op.cc | 1 + src/rgw/rgw_rest.cc | 3 +++ src/rgw/rgw_rest.h | 2 ++ 5 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/rgw/rgw_common.h b/src/rgw/rgw_common.h index 1d678f51c6897..e8c8918eb394d 100644 --- a/src/rgw/rgw_common.h +++ b/src/rgw/rgw_common.h @@ -164,6 +164,7 @@ struct req_state { const char *content_type; bool err_exist; struct rgw_err err; + bool expect_cont; XMLArgs args; diff --git a/src/rgw/rgw_main.cc b/src/rgw/rgw_main.cc index 08ac3c55bde06..ff8699d249c59 100644 --- a/src/rgw/rgw_main.cc +++ b/src/rgw/rgw_main.cc @@ -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) { diff --git a/src/rgw/rgw_op.cc b/src/rgw/rgw_op.cc index dd2236542fbcb..2e1784618a5f7 100644 --- a/src/rgw/rgw_op.cc +++ b/src/rgw/rgw_op.cc @@ -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(); } diff --git a/src/rgw/rgw_rest.cc b/src/rgw/rgw_rest.cc index c5dfc5e9f0bb3..d7e0860f07761 100644 --- a/src/rgw/rgw_rest.cc +++ b/src/rgw/rgw_rest.cc @@ -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) diff --git a/src/rgw/rgw_rest.h b/src/rgw/rgw_rest.h index 8fe09498e4105..ea49e67e40073 100644 --- a/src/rgw/rgw_rest.h +++ b/src/rgw/rgw_rest.h @@ -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: -- 2.39.5