Skip to content

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

@vlsi vlsi added the defect label Jun 15, 2023
@vlsi vlsi added this to the 5.6 milestone Jun 15, 2023
@vlsi vlsi force-pushed the filename branch 2 times, most recently from 830f99f to 3069b20 Compare June 15, 2023 19:43
@vlsi vlsi force-pushed the filename branch 3 times, most recently from 3069b20 to ee59a9e Compare June 15, 2023 21:01
… 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