From d8e3e64ec97a3c222a56bb6f510e5e23d7858615 Mon Sep 17 00:00:00 2001 From: Radoslaw Zarzynski Date: Fri, 17 Feb 2017 00:56:34 +0100 Subject: [PATCH] rgw: make sending Content-Length in 204 and 304 controllable This commit introduces a new configurable "rgw print prohibited content length" to let operator decide whether RadosGW complies to RFC 7230 (a part of the HTTP specification) or violates it but follows the Swift's behavior. Fixes: http://tracker.ceph.com/issues/16602 Signed-off-by: Radoslaw Zarzynski --- src/common/config_opts.h | 1 + src/rgw/rgw_client_io_filters.h | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/common/config_opts.h b/src/common/config_opts.h index b4e588242908..b302505d00de 100644 --- a/src/common/config_opts.h +++ b/src/common/config_opts.h @@ -1486,6 +1486,7 @@ OPTION(rgw_admin_entry, OPT_STR, "admin") // entry point for which a url is con OPTION(rgw_enforce_swift_acls, OPT_BOOL, true) OPTION(rgw_swift_token_expiration, OPT_INT, 24 * 3600) // time in seconds for swift token expiration OPTION(rgw_print_continue, OPT_BOOL, true) // enable if 100-Continue works +OPTION(rgw_print_prohibited_content_length, OPT_BOOL, false) // violate RFC 7230 and send Content-Length in 204 and 304 OPTION(rgw_remote_addr_param, OPT_STR, "REMOTE_ADDR") // e.g. X-Forwarded-For, if you have a reverse proxy OPTION(rgw_op_thread_timeout, OPT_INT, 10*60) OPTION(rgw_op_thread_suicide_timeout, OPT_INT, 0) diff --git a/src/rgw/rgw_client_io_filters.h b/src/rgw/rgw_client_io_filters.h index acf3b7874260..0ed151024132 100644 --- a/src/rgw/rgw_client_io_filters.h +++ b/src/rgw/rgw_client_io_filters.h @@ -291,7 +291,8 @@ public: size_t send_status(const int status, const char* const status_name) override { - if (204 == status || 304 == status) { + if ((204 == status || 304 == status) && + ! g_conf->rgw_print_prohibited_content_length) { action = ContentLengthAction::INHIBIT; } else { action = ContentLengthAction::FORWARD; -- 2.47.3