From 3252c10a1523b9aa753fd4a88503eb5959b165f9 Mon Sep 17 00:00:00 2001 From: Marcus Watts Date: Tue, 1 Mar 2016 03:22:19 -0500 Subject: [PATCH] Updated version of civetweb. Fixes here: Pull civetweb from new branch/commit. Build civetweb.c w/ USE_IPV6 (w/o depending on extra ceph-only build logic inside of civetweb.) Make several things "const" to please the compiler. Remap port string at '+' -> ,; to avoid , overload. Use new civetweb options validate_http_method=no canonicalize_url_path=no Signed-off-by: Marcus Watts --- CMakeLists.txt | 6 ++++++ src/CMakeLists.txt | 2 ++ src/civetweb | 2 +- src/rgw/rgw_civetweb.cc | 4 ++-- src/rgw/rgw_civetweb_frontend.cc | 4 +++- 5 files changed, 14 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index da7d3cbd8a2..2a77d0bf92f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -376,6 +376,12 @@ option(DEBUG_GATHER "C_Gather debugging is enabled" ON) option(HAVE_LIBZFS "LibZFS is enabled" OFF) option(ENABLE_COVERAGE "Coverage is enabled" OFF) option(PG_DEBUG_REFS "PG Ref debugging is enabled" OFF) +# we want to include civetweb.h as "civetweb/civetweb.h". Make it so. +execute_process( +COMMAND rm -f "${CMAKE_BINARY_DIR}/src/include/civetweb" +COMMAND mkdir -p "${CMAKE_BINARY_DIR}/src/include" +COMMAND ln -s "${CMAKE_SOURCE_DIR}/src/civetweb/include" + "${CMAKE_BINARY_DIR}/src/include/civetweb") option(WITH_TESTS "enable the build of ceph-test package scripts/binaries" ON) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 833a4280e80..bef81e12764 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -855,6 +855,8 @@ if(WITH_RADOSGW) add_library(civetweb_common_objs OBJECT ${civetweb_common_files}) target_include_directories(civetweb_common_objs PUBLIC "${CMAKE_SOURCE_DIR}/src/civetweb/include") + set_property(TARGET civetweb_common_objs + APPEND PROPERTY COMPILE_DEFINITIONS USE_IPV6=1) if(HAVE_SSL) set_property(TARGET civetweb_common_objs APPEND PROPERTY COMPILE_DEFINITIONS NO_SSL_DL=1) diff --git a/src/civetweb b/src/civetweb index e1249407043..cc0dfa11dad 160000 --- a/src/civetweb +++ b/src/civetweb @@ -1 +1 @@ -Subproject commit e12494070432b85d5ffce7dece81c0baad457a5f +Subproject commit cc0dfa11dadfca8a7021687aa537a3d377f244cb diff --git a/src/rgw/rgw_civetweb.cc b/src/rgw/rgw_civetweb.cc index c92eb843a83..2ed6fa7acfc 100644 --- a/src/rgw/rgw_civetweb.cc +++ b/src/rgw/rgw_civetweb.cc @@ -60,14 +60,14 @@ size_t RGWCivetWeb::complete_request() void RGWCivetWeb::init_env(CephContext *cct) { env.init(cct); - struct mg_request_info* const info = mg_get_request_info(conn); + const struct mg_request_info* info = mg_get_request_info(conn); if (! info) { return; } for (int i = 0; i < info->num_headers; i++) { - struct mg_request_info::mg_header* const header = &info->http_headers[i]; + const struct mg_request_info::mg_header* header = &info->http_headers[i]; const boost::string_ref name(header->name); const auto& value = header->value; diff --git a/src/rgw/rgw_civetweb_frontend.cc b/src/rgw/rgw_civetweb_frontend.cc index de9ea652691..17686f6e641 100644 --- a/src/rgw/rgw_civetweb_frontend.cc +++ b/src/rgw/rgw_civetweb_frontend.cc @@ -13,7 +13,7 @@ static int civetweb_callback(struct mg_connection* conn) { - struct mg_request_info* const req_info = mg_get_request_info(conn); + const struct mg_request_info* const req_info = mg_get_request_info(conn); return static_cast(req_info->user_data)->process(conn); } @@ -51,6 +51,8 @@ int RGWCivetWebFrontend::run() set_conf_default(conf_map, "decode_url", "no"); set_conf_default(conf_map, "enable_keep_alive", "yes"); conf_map["listening_ports"] = conf->get_val("port", "80"); + set_conf_default(conf_map, "validate_http_method", "no"); + set_conf_default(conf_map, "canonicalize_url_path", "no"); /* Set run_as_user. This will cause civetweb to invoke setuid() and setgid() * based on pw_uid and pw_gid obtained from pw_name. */ -- 2.39.5