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

Ian Cordasco sigmavirus24 at gmail.com
Fri Feb 12 14:12:26 UTC 2016

On Fri, Feb 12, 2016 at 5:13 AM, Victor Stinner <vstinner at redhat.com> wrote:
> Change 237027: For the encoding of HTTP headers, it looks like Swift doesn't
> respect HTTP RFCs. The HTTP requires headers to be encoded to Latin1, but
> Swift (server or client, sorry I don't know) encode headers to UTF-8.
> Something should be do too, but it will require a deep analysis, prepare a
> transition period, etc. This problem is complex and cannot be fixed right
> now.

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. Now a field value is defined as

    field-value = *( field-content / obs-fold )
    field-content = field-vchar [ 1*( SP / HTAB ) field-vchar ]
    field-vchar = VCHAR / obs-text
    obs-fold = CRLF 1*( SP / HTAB )
    obs-text = %x80-FF

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

For those interested, you can read up on headers in HTTP/1.1 here:


More information about the OpenStack-dev mailing list