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

fix: encode unicode characters in filenames when sending files in HTTP Sampler #5987

Merged
merged 2 commits into from
Jun 16, 2023

Conversation

vlsi
Copy link
Collaborator

@vlsi vlsi commented Jun 15, 2023

Description

Use RFC 7578 for encoding filenames when uploading files in HTTP Sampler.
HttpClient4 does not support filename encoding, so we encode it at JMeter side

Motivation and Context

See #4546

How Has This Been Tested?

See ConversionUtilsTest, HttpSamplerTest

… the most often used scenario

This is a follow-up to apache#678
@vlsi vlsi merged commit 13793b7 into apache:master Jun 16, 2023
@user412857
Copy link

If I understand well the fix consists in systematically encode file name in UTF8. Wouldn't it be better to encode only if it contains special characters?
How can the server know that the file name has been encoded?

@vlsi
Copy link
Collaborator Author

vlsi commented Jun 19, 2023

It looks like RFC 5987 is not the latest standard: https://source.chromium.org/chromium/chromium/src/+/main:third_party/blink/renderer/platform/network/form_data_encoder.cc;l=162-191;drc=4cd749d0d82138ff31ed3a2bc5d925bb6d83fe16, curl/curl#7789 (comment)

For field names and filenames for file fields, the result of the encoding in the previous bullet point must be escaped by replacing any 0x0A (LF) bytes with the byte sequence %0A, 0x0D (CR) with %0D and 0x22 (") with %22. The user agent must not perform any other escapes.

vlsi added a commit to vlsi/jmeter that referenced this pull request Jun 26, 2023
In PR 5987 HTTP sampler encoded filenames with percent encoding,
however, it should not encode all the characters.


Fixes apache#6005
This is a fixup to apache#5987
vlsi added a commit to vlsi/jmeter that referenced this pull request Jun 26, 2023
In PR 5987 HTTP sampler encoded filenames with percent encoding,
however, it should not encode all the characters.


Fixes apache#6005
This is a fixup to apache#5987
vlsi added a commit to vlsi/jmeter that referenced this pull request Jun 27, 2023
In PR 5987 HTTP sampler encoded filenames with percent encoding,
however, it should not encode all the characters.

Fixes apache#6005
This is a fixup to apache#5987
vlsi added a commit to vlsi/jmeter that referenced this pull request Jun 27, 2023
In PR 5987 HTTP sampler encoded filenames with percent encoding,
however, it should not encode all the characters.

Fixes apache#6005
This is a fixup to apache#5987
vlsi added a commit to vlsi/jmeter that referenced this pull request Jun 27, 2023
In PR 5987 HTTP sampler encoded filenames with percent encoding,
however, it should not encode all the characters.

Fixes apache#6005
This is a fixup to apache#5987
vlsi added a commit to vlsi/jmeter that referenced this pull request Jun 28, 2023
In PR 5987 HTTP sampler encoded filenames with percent encoding,
however, it should not encode all the characters.

Fixes apache#6005
This is a fixup to apache#5987
vlsi added a commit to vlsi/jmeter that referenced this pull request Jun 28, 2023
In PR 5987 HTTP sampler encoded filenames with percent encoding,
however, it should not encode all the characters.

Fixes apache#6005
This is a fixup to apache#5987
vlsi added a commit to vlsi/jmeter that referenced this pull request Jun 28, 2023
In PR 5987 HTTP sampler encoded filenames with percent encoding,
however, it should not encode all the characters.

Fixes apache#6005
This is a fixup to apache#5987
vlsi added a commit to vlsi/jmeter that referenced this pull request Jun 29, 2023
In PR 5987 HTTP sampler encoded filenames with percent encoding,
however, it should not encode all the characters.

Fixes apache#6005
This is a fixup to apache#5987
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants