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

No support for utf-8 encoded filenames in Content-Disposition #1888

Closed
devbazilio opened this Issue Sep 13, 2017 · 1 comment

Comments

Projects
None yet
3 participants
@devbazilio

devbazilio commented Sep 13, 2017

Content-Disposition: attachment; filename*=UTF-8''1.mp4
curl -JLO "SomeURL" ignores sent filename in headers.

This option is documented in RFC https://tools.ietf.org/html/rfc6266#page-7

curl 7.47.0 (x86_64-pc-linux-gnu) libcurl/7.47.0 GnuTLS/3.4.10 zlib/1.2.8 libidn/1.32 librtmp/2.3
Protocols: dict file ftp ftps gopher http https imap imaps ldap ldaps pop3 pop3s rtmp rtsp smb smbs smtp smtps telnet tftp
Features: AsynchDNS IDN IPv6 Largefile GSS-API Kerberos SPNEGO NTLM NTLM_WB SSL libz TLS-SRP UnixSockets

OS: ubuntu 18.0 x64

@maxdymond

This comment has been minimized.

Contributor

maxdymond commented Sep 13, 2017

(encoded filenames (*=) are not supported) */
This would agree!

reidwagner added a commit to reidwagner/curl that referenced this issue Oct 16, 2017

Content-Disposition: Add support for UTF-8 encoded filename* field.
If -J, --remote-header-name is specified, and filename* is given in Content-Disposition, it is decoded by libcurl's curl_easy_unescape according to RFC 3986 and used as the filename for -O, --remote-name.  A UTF-8 filename* takes precedence over an ASCII filename (no asterisk) if both are specified.

Closes curl#1888
Reported-by: devbazilio

reidwagner added a commit to reidwagner/curl that referenced this issue Oct 16, 2017

Content-Disposition: Add support for UTF-8 encoded filename* field.
If -J, --remote-header-name is specified, and filename* is given in Content-Disposition, it is decoded by libcurl's curl_easy_unescape according to RFC 3986 and used as the filename for -O, --remote-name.  A UTF-8 filename* takes precedence over an ASCII filename (no asterisk) if both are specified.

Closes curl#1888
Reported-by: devbazilio

reidwagner added a commit to reidwagner/curl that referenced this issue Oct 17, 2017

Content-Disposition: Add support for UTF-8 encoded filename* field.
If -J, --remote-header-name is specified, and filename* is given in Content-Disposition, it is decoded by libcurl's curl_easy_unescape according to RFC 3986 and used as the filename for -O, --remote-name.  A UTF-8 filename* takes precedence over an ASCII filename (no asterisk) if both are specified.

Closes curl#1888
Reported-by: devbazilio

reidwagner added a commit to reidwagner/curl that referenced this issue Oct 18, 2017

Content-Disposition: Add support for UTF-8 encoded filename* field.
If -J, --remote-header-name is specified, and filename* is given in Content-Disposition as utf-8 with a blank language tag, e.g. filename*=utf-8''foo%C2%AE, it is decoded by libcurl's curl_easy_unescape according to RFC 3986 and used as the filename for -O, --remote-name.  A UTF-8 filename* takes precedence over an ASCII filename (no asterisk) if both are specified.

Replacing memcmp with curl_strnequal also adds case insensitivity to filename and filename* parameters as is specified in RFC6266 section 4.3.

Closes curl#1888
Reported-by: devbazilio

reidwagner added a commit to reidwagner/curl that referenced this issue Oct 21, 2017

Content-Disposition: Add support for UTF-8 encoded filename* field.
If -J, --remote-header-name is specified, and filename* is given in Content-Disposition as utf-8 with a blank language tag, e.g. filename*=utf-8''foo%C2%AE, it is decoded by libcurl's curl_easy_unescape according to RFC 3986 and used as the filename for -O, --remote-name.  A UTF-8 filename* takes precedence over an ASCII filename (no asterisk) if both are specified.

Replacing memcmp with curl_strnequal also adds case insensitivity to filename and filename* parameters as is specified in RFC6266 section 4.3.

Closes curl#1888
Reported-by: devbazilio

reidwagner added a commit to reidwagner/curl that referenced this issue Oct 21, 2017

Content-Disposition: Add support for UTF-8 encoded filename* field.
If -J, --remote-header-name is specified, and filename* is given in Content-Disposition as utf-8 with a blank language tag, e.g. filename*=utf-8''foo%C2%AE, it is decoded by libcurl's curl_easy_unescape according to RFC 3986 and used as the filename for -O, --remote-name.  A UTF-8 filename* takes precedence over an ASCII filename (no asterisk) if both are specified.

Replacing memcmp with curl_strnequal also adds case insensitivity to filename and filename* parameters as is specified in RFC6266 section 4.3.

Closes curl#1888
Reported-by: devbazilio

@bagder bagder closed this in 094647f Jan 28, 2018

@lock lock bot locked as resolved and limited conversation to collaborators May 5, 2018

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.