Skip to content

Commit

Permalink
Merge remote-tracking branches '/pull/3851/head', '/pull/3852/head' a…
Browse files Browse the repository at this point in the history
…nd '/pull/3853/head' into firefly-backports
  • Loading branch information
ldachary committed Mar 3, 2015
3 parents d57b38f + 3dac68a + b13f483 commit edd37e3
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 8 deletions.
1 change: 1 addition & 0 deletions src/Makefile-env.am
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ LIBCLIENT = libclient.la
LIBCLIENT_FUSE = libclient_fuse.la
LIBRADOS = librados.la
LIBRGW = librgw.la
LIBCIVETWEB = libcivetweb.la
LIBRBD = librbd.la
LIBCEPHFS = libcephfs.la
LIBERASURE_CODE = liberasure_code.la
Expand Down
2 changes: 1 addition & 1 deletion src/civetweb
Submodule civetweb updated 1 files
+6 −0 include/civetweb_conf.h
20 changes: 15 additions & 5 deletions src/rgw/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,18 @@ LIBRGW_DEPS += \
-lfcgi \
-ldl

CIVETWEB_INCLUDE = --include civetweb/include/civetweb_conf.h

libcivetweb_la_SOURCES = \
rgw/rgw_civetweb.cc \
rgw/rgw_civetweb_log.cc \
civetweb/src/civetweb.c

libcivetweb_la_CXXFLAGS = ${CIVETWEB_INCLUDE} -Woverloaded-virtual ${AM_CXXFLAGS}
libcivetweb_la_CFLAGS = -Icivetweb/include ${CIVETWEB_INCLUDE}

noinst_LTLIBRARIES += libcivetweb.la

radosgw_SOURCES = \
rgw/rgw_resolve.cc \
rgw/rgw_rest.cc \
Expand All @@ -71,12 +83,9 @@ radosgw_SOURCES = \
rgw/rgw_swift.cc \
rgw/rgw_swift_auth.cc \
rgw/rgw_loadgen.cc \
rgw/rgw_civetweb.cc \
rgw/rgw_civetweb_log.cc \
civetweb/src/civetweb.c \
rgw/rgw_main.cc
radosgw_CFLAGS = -Icivetweb/include
radosgw_LDADD = $(LIBRGW) $(LIBRGW_DEPS) $(RESOLV_LIBS) $(CEPH_GLOBAL)
radosgw_CFLAGS = -I$(srcdir)/civetweb/include
radosgw_LDADD = $(LIBRGW) $(LIBCIVETWEB) $(LIBRGW_DEPS) $(RESOLV_LIBS) $(CEPH_GLOBAL)
bin_PROGRAMS += radosgw

radosgw_admin_SOURCES = rgw/rgw_admin.cc
Expand Down Expand Up @@ -162,5 +171,6 @@ noinst_HEADERS += \
rgw/rgw_civetweb_log.h \
civetweb/civetweb.h \
civetweb/include/civetweb.h \
civetweb/include/civetweb_conf.h \
civetweb/src/md5.h

26 changes: 24 additions & 2 deletions src/rgw/rgw_main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,8 @@ class RGWFrontendConfig {
bool get_val(const string& key, const string& def_val, string *out);
bool get_val(const string& key, int def_val, int *out);

map<string, string>& get_config_map() { return config_map; }

string get_framework() { return framework; }
};

Expand Down Expand Up @@ -916,6 +918,12 @@ class RGWMongooseFrontend : public RGWFrontend {
struct mg_context *ctx;
RGWProcessEnv env;

void set_conf_default(map<string, string>& m, const string& key, const string& def_val) {
if (m.find(key) == m.end()) {
m[key] = def_val;
}
}

public:
RGWMongooseFrontend(RGWProcessEnv& pe, RGWFrontendConfig *_conf) : conf(_conf), ctx(NULL), env(pe) {
}
Expand All @@ -928,9 +936,23 @@ class RGWMongooseFrontend : public RGWFrontend {
char thread_pool_buf[32];
snprintf(thread_pool_buf, sizeof(thread_pool_buf), "%d", (int)g_conf->rgw_thread_pool_size);
string port_str;
map<string, string> conf_map = conf->get_config_map();
conf->get_val("port", "80", &port_str);
const char *options[] = {"listening_ports", port_str.c_str(), "enable_keep_alive", "yes", "num_threads", thread_pool_buf,
"decode_url", "no", NULL};
conf_map.erase("port");
conf_map["listening_ports"] = port_str;
set_conf_default(conf_map, "enable_keep_alive", "yes");
set_conf_default(conf_map, "num_threads", thread_pool_buf);
set_conf_default(conf_map, "decode_url", "no");

const char *options[conf_map.size() * 2 + 1];
int i = 0;
for (map<string, string>::iterator iter = conf_map.begin(); iter != conf_map.end(); ++iter) {
options[i] = iter->first.c_str();
options[i + 1] = iter->second.c_str();
dout(20)<< "civetweb config: " << options[i] << ": " << (options[i + 1] ? options[i + 1] : "<null>") << dendl;
i += 2;
}
options[i] = NULL;

struct mg_callbacks cb;
memset((void *)&cb, 0, sizeof(cb));
Expand Down

0 comments on commit edd37e3

Please sign in to comment.