-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ISO-8859-1 encoded http headers #1102
Conversation
The tests don't pass. Also reading the new RFC 7230:
Not sure how to handle opaque data there. Also including such change we should also test if it works with some value given as unicode (which happen sometime in some countries...). Maybe we should have more tests there. Ideally we shouldn't transform anything there.
|
Of course, according to the WSGI spec, that's not supposed to happen in Python 2. Headers are specified to be given as the "native string type", so they should already be bytes and applications that send
So either case will enter implementation-defined behaviour and not be interoperable. |
👍 to this change |
return value | ||
if not isinstance(value, text_type): | ||
raise TypeError('%r is not a string' % value) | ||
return value.encode("latin1") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
latin1 -> latin-1. latin1 is an alias of latin-1.
Good catch, thanks! Could you please squash the commits? |
Ok, squashed the commits :). |
@@ -57,7 +57,7 @@ Commonly Used Arguments | |||
Check the :ref:`faq` for ideas on tuning this parameter. | |||
* ``-k WORKERCLASS, --worker-class=WORKERCLASS`` - The type of worker process | |||
to run. You'll definitely want to read the production page for the | |||
implications of this parameter. You can set this to ``$(NAME)`` | |||
implications of this parameter. You can set this to ``egg:gunicorn#$(NAME)`` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change shouldn't be here :) See the original commit: 8de5eb9
In general, the patch LGTM except this, but I can take care of it if you don't have time.
Thanks!
Yup, this line was a leftover from an unintentional merge :/. Thanks for pointing it out - it's now removed. |
ISO-8859-1 encoded http headers
Thanks! |
ISO-8859-1 encoded http headers
Hi,
gunicorn uses utf8 encoding for http response headers. I don't know
much about http standards, but this is probably not correct:
http://stackoverflow.com/questions/4400678/http-header-should-use-what-character-encoding
best regards,
Jochen