From 23323b7f725dc1e99e4a81512b57d342dab9a3fe Mon Sep 17 00:00:00 2001 From: Jiaying Ren Date: Mon, 7 Aug 2017 17:30:27 +0800 Subject: [PATCH] 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 --- src/rgw/rgw_log.cc | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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); -- 2.47.3