]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: more cors fixes
authorBabu Shanmugam <anbu@enovance.com>
Thu, 28 Mar 2013 05:05:01 +0000 (10:35 +0530)
committerSage Weil <sage@inktank.com>
Mon, 1 Apr 2013 04:51:59 +0000 (21:51 -0700)
Remove the check for read_cors_config in rgw_main.cc, and changes type of 'a' to unsigned from long as max_age cannot be a negative integer

Modified the type of 'a' to unsigned long and used ULONG_MAX and strtol in rgw_cors_swift.h

Signed-off-by: Babu Shanmugam <anbu@enovance.com>
src/rgw/rgw_cors_swift.h
src/rgw/rgw_main.cc

index dcce4830d02dc008675d9eb7a4b5fd6bf520e1f6..2b10681d7681d3ea0cc8e9ae5458cf5451ed60a3 100644 (file)
@@ -35,7 +35,7 @@ class RGWCORSConfiguration_SWIFT : public RGWCORSConfiguration
                   const char *expose_headers, const char *max_age) {
       set<string> o, h, oc;
       list<string> e;
-      long a = CORS_MAX_AGE_INVALID;
+      unsigned a = CORS_MAX_AGE_INVALID;
       uint8_t flags = RGW_CORS_ALL;
 
       string ao = allow_origins;
@@ -58,14 +58,15 @@ class RGWCORSConfiguration_SWIFT : public RGWCORSConfiguration
             return -EINVAL;
         }
       }
+
       if (expose_headers) {
         string eh = expose_headers;
         get_str_list(eh, e);
       }
       if (max_age) {
         char *end = NULL;
-        a = strtol(max_age, &end, 10);
-        if (a == LONG_MAX)
+        a = strtoul(max_age, &end, 10);
+        if (a == ULONG_MAX)
           a = CORS_MAX_AGE_INVALID;
       }
 
index cadc51e7b3f1c2c659a14b76e0d47c3ea7de1e13..b99bdf9890ea3680c5715b5d26b1a4c0f73139c4 100644 (file)
@@ -330,12 +330,9 @@ void RGWProcess::handle_request(RGWRequest *req)
     abort_early(s, ret);
     goto done;
   }
+
   req->log(s, "reading the cors attr");
-  ret = handler->read_cors_config();
-  if (ret < 0) {
-    abort_early(s, ret);
-    goto done;
-  }
+  handler->read_cors_config();
   
   req->log(s, "verifying op permissions");
   ret = op->verify_permission();