Archive of RubyForge sup-devel mailing list
 help / color / mirror / Atom feed
* [sup-devel] [PATCH] RFC 2231: value encoding for Content-Disposition
@ 2010-10-14 13:09 Gregor Hoffleit
  0 siblings, 0 replies; only message in thread
From: Gregor Hoffleit @ 2010-10-14 13:09 UTC (permalink / raw)
  To: sup-devel

[Please, comment on this one and fill in the blank...]

RFC 2231 defines extensions to RFC 2183 disposition parameter
value mechanisms to provide value character set information
(http://greenbytes.de/tech/webdav/rfc2231.html#rfc.section.4),
e.g.:
    Content-Disposition: attachment; filename*=UTF-8''foo-%c3%a4-%e2%82%ac.html

The following pattern detects the cases described in 
http://greenbytes.de/tech/tc2231/#encoding-2231-char
(RFC2231 Encoding: Character Sets).

TODO: The value of filename ($2) must be decoded according to
the encoding specified in $1.

---
 lib/sup/message.rb |   11 +++++++++++
 1 files changed, 11 insertions(+), 0 deletions(-)

diff --git a/lib/sup/message.rb b/lib/sup/message.rb
index cf0e505..0b42f75 100644
--- a/lib/sup/message.rb
+++ b/lib/sup/message.rb
@@ -480,6 +480,17 @@ private
         ## separated by ";". So, we match everything up to " and ; (if present).
         if m.header["Content-Disposition"] && m.header["Content-Disposition"] =~ /filename="?(.*?[^\\])("|;|\z)/m
           $1
+        elsif m.header["Content-Disposition"] && m.header["Content-Disposition"] =~ /filename\*=(.*)''(.*)("|;|$)/
+          ## RFC 2231 defines extensions to RFC 2183 disposition parameter
+          ## value mechanisms to provide value character set information
+          ## (http://greenbytes.de/tech/webdav/rfc2231.html#rfc.section.4),
+          ## e.g.:
+          ##     Content-Disposition: attachment; filename*=UTF-8''foo-%c3%a4-%e2%82%ac.html
+          ##
+          ## The following pattern detects the cases described in 
+          ## http://greenbytes.de/tech/tc2231/#encoding-2231-char
+          ## (RFC2231 Encoding: Character Sets).
+          ##
+          ## TODO: The value of filename ($2) must be decoded according to
+          ## the encoding specified in $1.
+          $2
         elsif m.header["Content-Type"] && m.header["Content-Type"] =~ /name="?(.*?[^\\])("|;|\z)/im
           $1
--
1.5.6.5
 
_______________________________________________
Sup-devel mailing list
Sup-devel@rubyforge.org
http://rubyforge.org/mailman/listinfo/sup-devel


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2010-10-14 13:29 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-10-14 13:09 [sup-devel] [PATCH] RFC 2231: value encoding for Content-Disposition Gregor Hoffleit

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox