Skip to content
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

Receiving file with name containing chars outside of US-ASCII range fails. #1051

Open
piotrek-toolla opened this issue Jun 10, 2020 · 1 comment

Comments

@piotrek-toolla
Copy link

piotrek-toolla commented Jun 10, 2020

According to https://tools.ietf.org/html/rfc5987 (https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Disposition) Content-Disposition header must contain chars from US-ASCII range.
However, in https://tools.ietf.org/html/rfc7578#section-4.2 it says:

Some commonly deployed systems use multipart/form-data with file
names directly encoded including octets outside the US-ASCII range.
The encoding used for the file names is typically UTF-8, although
HTML forms will use the charset associated with the form.

That means a request:

new RqFake(
            new ListOf<>(
                "GET /",
                "Content-Type: multipart/form-data; boundary=--13"
            ),
            String.join(
                "\r\n",
                "----13",
                "Content-Disposition: form-data; name=\"file\"; filename=\"teść.txt\"",
                "Content-Type: text/plain",
                "",
                "hello world",
                "",
                "----13",
                "Content-Disposition: form-data; name=\"type\"",
                "",
                "netex",
                "----13--",
                ""
            )
        );

should be allowed but it currently fails on:

org.takes.HttpException: [400] illegal character 0xC5 in HTTP header line #2: "ontent-Disposition: form-data; name="file"; filename="te"
	at org.takes.rq.RqLive.legalCharacter(RqLive.java:153)
	at org.takes.rq.RqLive.parse(RqLive.java:86)
	at org.takes.rq.RqLive.<init>(RqLive.java:54)
@0crat
Copy link
Collaborator

0crat commented Jun 10, 2020

@paulodamaso/z please, pay attention to this issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants