User Metadata keys with Underscore get translated to dash
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
OpenStack Object Storage (swift) |
Won't Fix
|
Low
|
Unassigned | ||
Swift3 |
Fix Released
|
Undecided
|
Unassigned |
Bug Description
User keys with an _ in them get translated to -. This occurs for Account, Container, and Object keys.
While this may not be a huge issue in swift as the translation is consistent, it matters for use with Swift3. When using Swift3 the client must sign all headers. The signature on the client side is calculated on an underscore, but the Swift3 system calculates based on the translated dash. As a result, it is not possible to access a swift backend using keys with underscores as the signature will always fail.
Below is an example:
$ curl -i -X POST -H "$token" -H "X-Object-
HTTP/1.1 202 Accepted
Content-Length: 76
Content-Type: text/html; charset=UTF-8
X-Trans-Id: txd00a4cecda624
Date: Sat, 20 Jun 2015 03:33:15 GMT
$ curl -i -X HEAD -H "$token" $surl/test/
HTTP/1.1 200 OK
Content-Length: 12
X-Object-
Accept-Ranges: bytes
Last-Modified: Sat, 20 Jun 2015 03:33:16 GMT
Etag: ed076287532e863
X-Timestamp: 1434771195.67249
Content-Type: application/
X-Trans-Id: txb8edee8726d34
Date: Sat, 20 Jun 2015 03:34:20 GMT
I'm not sure that either OpenStack Swift or Swift3 can fix this one; the translation is happening down at the Eventlet level. It's not just Eventlet that does it; I looked at gunicorn's WSGI server, and they do it too.
In fact, it looks like this translation is required(!) by PEP 3333. The section "Environment Variables" refers to the CGI specification, which is RFC 3875 (https:/ /www.ietf. org/rfc/ rfc3875). Section 4.1.18 there says:
Meta-variables with names beginning with "HTTP_" contain values read
from the client request header fields, if the protocol used is HTTP.
The HTTP header field name is converted to upper case, has all
occurrences of "-" replaced with "_" and has "HTTP_" prepended to
give the meta-variable name.
So, that thing with the dashes and underscores? Required by the standard. See also <http:// wompwompwomp. com/>.