From: Jiaying Ren Date: Mon, 7 Aug 2017 09:30:27 +0000 (+0800) Subject: rgw: fix opslog can't record referrer when using curl as client X-Git-Tag: v13.0.1~1147^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=23323b7f725dc1e99e4a81512b57d342dab9a3fe;p=ceph.git rgw: fix opslog can't record referrer when using curl as client Fixes: http://tracker.ceph.com/issues/20935 Reported-by: Zhang Shaowen Signed-off-by: Jiaying Ren --- diff --git a/src/rgw/rgw_log.cc b/src/rgw/rgw_log.cc index 7bceab0aa689..e3fe7c486355 100644 --- a/src/rgw/rgw_log.cc +++ b/src/rgw/rgw_log.cc @@ -346,7 +346,11 @@ int rgw_log_op(RGWRados *store, RGWREST* const rest, struct req_state *s, else set_param_str(s, "REMOTE_ADDR", entry.remote_addr); set_param_str(s, "HTTP_USER_AGENT", entry.user_agent); - set_param_str(s, "HTTP_REFERRER", entry.referrer); + // legacy apps are still using misspelling referer, such as curl -e option + if (s->info.env->exists("HTTP_REFERRER")) + set_param_str(s, "HTTP_REFERRER", entry.referrer); + else + set_param_str(s, "HTTP_REFERER", entry.referrer); set_param_str(s, "REQUEST_URI", entry.uri); set_param_str(s, "REQUEST_METHOD", entry.op);