Accept international RFC 2231 headers #868

gagern opened this Issue Aug 7, 2013 · 0 comments


None yet

2 participants


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";

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 shazow/urllib3#119, where this bug caused a test to fail once a proper standards-conforming encoding was implemented.

@gagern gagern added a commit to gagern/urllib3 that referenced this issue Aug 7, 2013
@gagern gagern Simulate a standards-compliant web server.
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
@gagern gagern added a commit to gagern/tornado that referenced this issue Aug 7, 2013
@gagern gagern Accept header parameters in RFC 2231 format.
This should fix tornadoweb/tornado#868.
@bdarnell bdarnell added the httpserver label Jul 16, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment