]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: fix authentication
authorYehuda Sadeh <yehuda@hq.newdream.net>
Thu, 28 Jul 2011 19:34:30 +0000 (12:34 -0700)
committerYehuda Sadeh <yehuda@hq.newdream.net>
Thu, 28 Jul 2011 21:03:38 +0000 (14:03 -0700)
src/rgw/rgw_rest_s3.cc

index df18c7fd4d6480836e98317f258f0306feced773..0885e990673b39d5d2f0ffe718492b8fe82143cb 100644 (file)
@@ -581,17 +581,20 @@ static bool get_auth_header(struct req_state *s, string& dest, bool qsr)
   if (qsr) {
     date = s->args.get("Expires");
   } else {
-    const char *str = s->env->get("HTTP_X_AMZ_DATE");
-    if (!str)
-      str = s->env->get("HTTP_DATE");
-    if (!str) {
-      RGW_LOG(0) << "missing date for auth header" << dendl;
-      return false;
+    const char *str = s->env->get("HTTP_DATE");
+    const char *req_date = str;
+    if (str) {
+      date = str;
+    } else {
+      req_date = s->env->get("HTTP_X_AMZ_DATE");
+      if (!req_date) {
+        RGW_LOG(0) << "missing date for auth header" << dendl;
+        return false;
+      }
     }
 
-    date = str;
     struct tm t;
-    if (!parse_rfc2616(str, &t)) {
+    if (!parse_rfc2616(req_date, &t)) {
       RGW_LOG(0) << "failed to parse date for auth header" << dendl;
       return false;
     }