Opened 4 years ago

Last modified 3 years ago

#16470 new New feature

RFC6266 Support

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

Description

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:

http://trac.tools.ietf.org/wg/httpbis/trac/wiki/ContentDispositionProducerAdvice

Change History (4)

comment:1 Changed 4 years ago by jreschke

  • Cc jreschke added
  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset

comment:2 Changed 4 years ago by aaugustin

  • Component changed from Internationalization to HTTP handling
  • Triage Stage changed from Unreviewed to Accepted

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 4 years ago by anonymous

Mark had discussed this with me over twitter/email a couple days ago. He's got an example implementation here: https://github.com/mnot/sweet/blob/master/lib/index.js

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 3 years ago by Clueless

This seems to be special case of the encoding in http://tools.ietf.org/html/rfc5987

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

Note: See TracTickets for help on using tickets.
Back to Top