]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
Swift: Set Content-Length when requesting/checking Keystone tokens 4468/head
authorHervé Rousseau <hroussea@cern.ch>
Mon, 27 Apr 2015 15:54:30 +0000 (17:54 +0200)
committerHervé Rousseau <hroussea@cern.ch>
Mon, 27 Apr 2015 16:18:26 +0000 (18:18 +0200)
Running Keystone with WSGIChunkedRequest=On is not supported.

We have to make sure that we set the Content-Length header when getting
an admin token and checking revoked tokens, otherwise Keystone returns
a HTTP 411 error.

Same applies when checking revoked tickets.

Fixes: #11473
Backport: Hammer, Firefly
Signed-off-by: Hervé Rousseau <hroussea@cern.ch>
src/rgw/rgw_swift.cc

index 76f21eeb16b61ad6cc979cec419d1f88ae74c31c..a08d94400d643dd24f1565d829fb338fc895f763 100644 (file)
@@ -269,6 +269,7 @@ int RGWSwift::get_keystone_admin_token(std::string& token)
     std::stringstream ss;
     jf.flush(ss);
     token_req.set_post_data(ss.str());
+    token_req.set_send_length(ss.str().length());
     int ret = token_req.process("POST", token_url.c_str());
     if (ret < 0)
       return ret;
@@ -296,6 +297,7 @@ int RGWSwift::check_revoked()
     return -EINVAL;
   url.append("v2.0/tokens/revoked");
   req.append_header("X-Auth-Token", token);
+  req.set_send_length(0);
   int ret = req.process(url.c_str());
   if (ret < 0)
     return ret;