Skip to content
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

Accept international RFC 2231 headers #868

Closed
gagern opened this issue Aug 7, 2013 · 0 comments
Closed

Accept international RFC 2231 headers #868

gagern opened this issue Aug 7, 2013 · 0 comments

Comments

@gagern
Copy link
Contributor

gagern commented Aug 7, 2013

RFC 2388 Section 4.4 states:

if the file name of the sender's operating system is not in US-ASCII, the file name might be approximated, or encoded using the method of RFC 2231.

The current tornado.httputil._parse_header implementation does not allow for the second of these alternatives: it does not properly decode a header of the form

Content-Disposition: form-data; name="fieldname";
 file*=utf-8''T%C3%A4st.txt

The same holds for non-ascii names of form fields. You can use the email.utils.decode_params function to perform this kind of decoding, as well as handle the continuations described in that same RFC.

This report here is the counterpart to urllib3/urllib3#119, where this bug caused a test to fail once a proper standards-conforming encoding was implemented.

gagern added a commit to gagern/urllib3 that referenced this issue Aug 7, 2013
This is an ugly work-around for tornadoweb/tornado#868: we override one of
their internal functions, hoping that they don't decide to change its
semantics.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants