]> 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 16863/head
authorJiaying Ren <jiaying.ren@umcloud.com>
Mon, 7 Aug 2017 09:30:27 +0000 (17:30 +0800)
committerJiaying Ren <jiaying.ren@umcloud.com>
Thu, 10 Aug 2017 02:48:01 +0000 (10:48 +0800)
Fixes: http://tracker.ceph.com/issues/20935
Reported-by: Zhang Shaowen <zhangshaowen@cmss.chinamobile.com>
Signed-off-by: Jiaying Ren <jiaying.ren@umcloud.com>
src/rgw/rgw_log.cc

index 7bceab0aa689636031a1eef3f075fad869116a91..e3fe7c486355c19b354402e40569ad50407342b6 100644 (file)
@@ -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);