Opened 7 years ago

Last modified 2 years ago

#16470 new New feature

RFC5987/RFC6266 Support (Content-Disposition headers)

Reported by: mnot@… Owned by: nobody
Component: HTTP handling Version: 1.3
Severity: Normal Keywords:
Cc: jdunck@…, jreschke Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no


RFC6266, recently published by the IETF HTTPbis WG, describes a way to use the Content-Disposition header in HTTP in a manner whereby almost all current browsers can handle files (e.g., downloading with disposition 'attachment') that have non-ASCII characters in them, with other browsers using an ASCII fallback.

Django currently does not have an API for setting Content-Disposition, although there are a few references to it in the documentation. Adding such an API would allow Django sites to download files in any language easily.

Additionally, there's advice in the RFC that, properly implemented in a Django API, would help sites avoid common pitfalls.

For more information, see:

Change History (5)

comment:1 Changed 7 years ago by jreschke

Cc: jreschke added

comment:2 Changed 7 years ago by Aymeric Augustin

Component: InternationalizationHTTP handling
Triage Stage: UnreviewedAccepted

This is a very common problem for developers, and I think it's in the realm of what Django should do. I guess it means adding a method to HttpResponse.

If the implementation isn't completely obvious, please start a discussion to django-developers to ensure consensus.

comment:3 Changed 7 years ago by anonymous

Mark had discussed this with me over twitter/email a couple days ago. He's got an example implementation here:

I was thinking of trying to keep the existing API of dict key/value as header/value pair, but having __setitem__ do some special-casing on Content-Disposition. This would allow do something sensible for all existing code, and we could still add an extra method if people wanted finder control over the fallback filename.

comment:4 Changed 6 years ago by Alex Ogier

This seems to be special case of the encoding in

Seems to me that whatever solution we come up with should generalize to any header that allows RFC 5987-style encodings.

comment:5 Changed 2 years ago by Collin Anderson

Summary: RFC6266 SupportRFC5987/RFC6266 Support (Content-Disposition headers)
Note: See TracTickets for help on using tickets.
Back to Top