Skip to content

Commit

Permalink
rgw: make compatability deconfliction optional.
Browse files Browse the repository at this point in the history
Per request from Yehuda, the deconfliction for having both
HTTP_CONTENT_LENGTH and CONTENT_LENGTH set is now optional, and
controlled by new configuration boolean, which defaults to false.
rgw content length compat

X-URL: #4436 (comment)
Signed-off-by: Robin H. Johnson <robbat2@gentoo.org>
(cherry picked from commit 79d17af)
  • Loading branch information
robbat2 authored and theanalyst committed Jul 1, 2015
1 parent 0260abd commit d9bbef3
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
6 changes: 6 additions & 0 deletions doc/radosgw/config-ref.rst
Expand Up @@ -316,6 +316,12 @@ Ceph configuration file, the default value will be set automatically.
:Default: ``admin``


``rgw content length compat``

:Description: Enable compatability handling of FCGI requests with both CONTENT_LENGTH AND HTTP_CONTENT_LENGTH set.
:Type: Boolean
:Default: ``false``

Regions
=======

Expand Down
1 change: 1 addition & 0 deletions src/common/config_opts.h
Expand Up @@ -938,6 +938,7 @@ OPTION(rgw_socket_path, OPT_STR, "") // path to unix domain socket, if not spe
OPTION(rgw_host, OPT_STR, "") // host for radosgw, can be an IP, default is 0.0.0.0
OPTION(rgw_port, OPT_STR, "") // port to listen, format as "8080" "5000", if not specified, rgw will not run external fcgi
OPTION(rgw_dns_name, OPT_STR, "")
OPTION(rgw_content_length_compat, OPT_BOOL, false) // Check both HTTP_CONTENT_LENGTH and CONTENT_LENGTH in fcgi env
OPTION(rgw_script_uri, OPT_STR, "") // alternative value for SCRIPT_URI if not set in request
OPTION(rgw_request_uri, OPT_STR, "") // alternative value for REQUEST_URI if not set in request
OPTION(rgw_swift_url, OPT_STR, "") // the swift url, being published by the internal swift auth
Expand Down
4 changes: 2 additions & 2 deletions src/rgw/rgw_rest.cc
Expand Up @@ -1370,7 +1370,7 @@ int RGWREST::preprocess(struct req_state *s, RGWClientIO *cio)
/* Easy case #1: CONTENT_LENGTH is missing or empty */
s_contentlength = s_httpcontentlength;
s_httpcontentlength = NULL;
} else if (s_contentlength && s_httpcontentlength) {
} else if (s->cct->_conf->rgw_content_length_compat && s_contentlength && s_httpcontentlength) {
/* Hard case: Both are set, we have to disambiguate */
int64_t i_contentlength = -1, i_httpcontentlength = -1;
// Test CONTENT_LENGTH
Expand Down Expand Up @@ -1411,7 +1411,7 @@ int RGWREST::preprocess(struct req_state *s, RGWClientIO *cio)
s_httpcontentlength = NULL;
}
}

// End of: else if (s->cct->_conf->rgw_content_length_compat && s_contentlength && s_httpcontentlength) {
} else {
// By implication, httpcontentlength is NULL here
/* Easy case #2: HTTP_CONTENT_LENGTH is not set */
Expand Down

0 comments on commit d9bbef3

Please sign in to comment.