Skip to contentSkip to conversation

Swift: Set Content-Length when requesting/checking Keystone tokens

PATCH In review Herve Rousseau 2 participants 3 messages Apr 25, 2015 – Apr 27, 2015

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Swift: Set Content-Length when requesting/checking Keystone tokens

From: Hervé Rousseau <[email protected]>

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.

---
 src/rgw/rgw_swift.cc |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
src/rgw/rgw_swift.cc +2 -0
index 76f21ee..a08d944 100644
@@ -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;
Signature · 6 lines
1.7.1

--
To unsubscribe from this list: send the line "unsubscribe ceph-devel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#1 lore raw
Quoted 11 lines · Herve Rousseau

From: Hervé Rousseau <[email protected]>

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.

[snip]

Hi all,

We identified this issue when doing some integration tests with Keystone and user/password authentication instead of using the admin token, it's related to http://tracker.ceph.com/issues/7796.

We followed the aforementioned bug report and directives but then keystone wouldn't work because they won't support Chunked encoding as their documentation now reflects:
https://git.openstack.org/cgit/openstack/keystone/commit/?id=05c01e26d1e62298489ba3894576faf3c352e2c9

Cheers,

Signature · 5 lines
Hervé Rousseau
--
To unsubscribe from this list: send the line "unsubscribe ceph-devel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#2 lore raw
In reply to Herve Rousseau

This looks good. Can you send a pull request to the ceph github repository?

Thanks,
Yehuda

----- Original Message -----

Quoted 45 lines

From: "Herve Rousseau" <[email protected]>
To: [email protected]
Cc: "Hervé Rousseau" <[email protected]>
Sent: Saturday, April 25, 2015 9:38:58 AM
Subject: [PATCH] Swift: Set Content-Length when requesting/checking Keystone tokens

From: Hervé Rousseau <[email protected]>

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.

---
 src/rgw/rgw_swift.cc |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
src/rgw/rgw_swift.cc +1 -0
index 76f21ee..a08d944 100644
@@ -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;
src/rgw/rgw_swift.cc +1 -1
@@ -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;
--

1.7.1

Quoted 5 lines

--
To unsubscribe from this list: send the line "unsubscribe ceph-devel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

--
To unsubscribe from this list: send the line "unsubscribe ceph-devel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html