]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: fix opslog can't record referrer when using curl as client
authorJiaying Ren <jiaying.ren@umcloud.com>
Mon, 7 Aug 2017 09:30:27 +0000 (17:30 +0800)
committerCasey Bodley <cbodley@redhat.com>
Mon, 8 Jan 2018 21:28:59 +0000 (16:28 -0500)
Fixes: http://tracker.ceph.com/issues/20935
Reported-by: Zhang Shaowen <zhangshaowen@cmss.chinamobile.com>
Signed-off-by: Jiaying Ren <jiaying.ren@umcloud.com>
(cherry picked from commit 23323b7f725dc1e99e4a81512b57d342dab9a3fe)

src/rgw/rgw_log.cc

index 588aa0a26fde84b8b626c0864ed5977f06fb7129..b8378174ee878e088aed71ec57e0c6f7a03a6eeb 100644 (file)
@@ -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);