[Web-SIG] Output header encodings? (was Re: Backup plan: WSGI 1 Addenda and wsgiref update for Py3)

Jeff Hardy jdhardy at gmail.com
Thu Sep 23 20:33:26 CEST 2010

On Thu, Sep 23, 2010 at 11:52 AM, P.J. Eby <pje at telecommunity.com> wrote:
>> I do think input and output should be symmetric, though. If response
>> headers are going to be bytes, then the request headers should be as
>> well, or vice versa. The same arguments apply to both, after all.
> Actually, they don't.  There are more apps than servers, so more code to get
> right, by more people.  Servers also don't generally *create* any of the
> bytes or text involved, they're just ferrying it from one place to the next.
>  So the API conditions are not symmetrical.

How so? If I'm writing an application, I would need to deal with
strings in environ but remember to send bytes to start_response.
Conversions can happen on the application side either way. I just
don't see how having strings in->bytes out is more error-prone than
bytes-in->bytes-out or strings in->strings out, from an application or
a server perspective.

Also, IronPython/.NET falls outside of "generally". Every .NET server
I've seen deals with headers exclusively as strings (like Python 3,
.NET strings are Unicode), so NWSGI would be encoding the response
headers to strings, but passing the request headers through unchanged.

- Jeff

More information about the Web-SIG mailing list