[openstack-dev] [swift] Plan to add Python 3 support to Swift

Victor Stinner vstinner at redhat.com
Fri Feb 12 16:41:31 UTC 2016


Le 12/02/2016 15:12, Ian Cordasco a écrit :
> Just to interject here, RFC 2616 is the one you're talking about. That
> encoding requirement was dropped when HTTP/1.1 was updated in the
> 7230-7235 RFCs. (...)
> Where VCHAR is any visible US ASCII character. So while UTF-8 is still
> a bad idea for the header value (and in fact, http.client on Python 3
> will auto-encode headers to Latin 1) Latin 1 is no longer the
> requirement.
>
> For those interested, you can read up on headers in HTTP/1.1 here:
> https://tools.ietf.org/html/rfc7230#section-3.2

Oh thanks, it looks like my HTTP skills are rusty :-)

For Swift, it's maybe better to always try to use UTF-8, but fallback to 
Latin1 if an HTTP cannot be decoded from UTF-8. Swift has many clients 
implemented in various programming languages, I'm not sure that all 
clients use UTF-8.

By the way, https://review.openstack.org/#/c/237027/ was merged, cool.

I fixed the third patch mentioned in my previous email to support 
arbitrary byte strings for hash prefix and suffix in the configuration file:
https://review.openstack.org/#/c/236998/

I also updated my HTTP parser patch for Python 3. With these two 
patches, test_utils now pass on Python 3.
https://review.openstack.org/#/c/237042/

For me, it's a nice milestone to have test_utils working on Python 3. It 
allows to port more interesting stuff and start the real portage work ;-)

Victor



More information about the OpenStack-dev mailing list