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: v12.2.3~126^2~16 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=e7bd12a38716d17a7d6b752d6730d5913916cded;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 (cherry picked from commit 23323b7f725dc1e99e4a81512b57d342dab9a3fe) --- diff --git a/src/rgw/rgw_log.cc b/src/rgw/rgw_log.cc index 588aa0a26fde..b8378174ee87 100644 --- a/src/rgw/rgw_log.cc +++ b/src/rgw/rgw_log.cc @@ -351,7 +351,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);