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

HTTP sampler corrupts filename with Chinese characters when upload file with http sampler #4546

Closed
asfimport opened this issue Oct 26, 2017 · 13 comments

Comments

@asfimport
Copy link
Collaborator

Nick.Yin (Bug 61669):
precondition:
use multipart/form-data for Post and Browser-compatible headers is chosen.

step:
1.add a HTTP sample to threadgroup
2.choose a file with Chinese character in file upload area in sampler
3. excute the test

excepted result:
the file whose file name is Chinese character is displayed in view result tree

actual:
the file name displays like ?????

by the way: it was working fine with Jmeter 3.1

Created attachment filename1.PNG: filename with chinese charactor

filename with chinese charactor

Severity: major
OS: All

Duplicates:

@asfimport
Copy link
Collaborator Author

Nick.Yin (migrated from Bugzilla):
Created attachment filename2.PNG: filename with English

filename with English

@asfimport
Copy link
Collaborator Author

@pmouawad (migrated from Bugzilla):
See:

RFC 2388 4.4 applies here and the filenames can be encoded using RFC 2231.

See discussion around #4460

@asfimport
Copy link
Collaborator Author

Nick.Yin (migrated from Bugzilla):
Created attachment http-request with jmeter3.2.png: http-request of jmeter3.2

http-request of jmeter3.2

@asfimport
Copy link
Collaborator Author

Nick.Yin (migrated from Bugzilla):
Created attachment result of jmeter3.2.png: result of jmeter3.2

result of jmeter3.2

@asfimport
Copy link
Collaborator Author

Nick.Yin (migrated from Bugzilla):
Created attachment http-request with jmeter3.3.png: http-request of jmeter3.3

http-request of jmeter3.3

@asfimport
Copy link
Collaborator Author

Nick.Yin (migrated from Bugzilla):
Created attachment result of jemeter3.3.png: result of jmeter3.3

result of jmeter3.3

@asfimport
Copy link
Collaborator Author

Nick.Yin (migrated from Bugzilla):
I tried with Jmeter 3.2 compared to Jmeter 3.3, and found it's working fine with Jmeter 3.2. See the attachment.
and I reviewed the release note of Jmeter3.3 , I'm still thinking it's a bug.(In reply to Philippe Mouawad from comment 2)

See:

https://stackoverflow.com/questions/20591599/why-arent-post-names-with-
unicode-sent-correctly-when-using-multipart-form-data/20592910#20592910

RFC 2388 4.4 applies here and the filenames can be encoded using RFC 2231.

See discussion around #4460

@asfimport
Copy link
Collaborator Author

@pmouawad (migrated from Bugzilla):
Hello,
It's not a regression although you might think so.

JMeter 3.2 was wrong in working the way it was.
The change is due to #4460.

See :

Also have a look at TEST_HTTP.jmx you'll see that tests consider this.

If you think I am wrong in my analysis, can you point me to the RFC that contradicts JMeter behaviour ?

Thank you

@vlsi vlsi changed the title HTTP sampler corrupts file with Chinese characters when upload file with http sampler (NEED REPRODUCER CASE to confirm) HTTP sampler corrupts filename with Chinese characters when upload file with http sampler Jun 14, 2023
@vlsi
Copy link
Collaborator

vlsi commented Jun 14, 2023

The syntax is to send the filename twice: https://greenbytes.de/tech/webdav/rfc5987.html#examples

We probably need implementing it

@user412857
Copy link

The syntax is to send the filename twice: https://greenbytes.de/tech/webdav/rfc5987.html#examples

We probably need implementing it

Can you be more precise? How to send the filename twice? How to do that using BeanShell PreProcessor instead of HTTP Request Files Upload?
Maybe a sample would help

@vlsi
Copy link
Collaborator

vlsi commented Jun 14, 2023

Let me explain:

  1. As seen in HTTP sampler corrupts filename with Chinese characters when upload file with http sampler #4546 (comment), JMeter uses Content-Disposition: form-data header to pass files.
  2. However, historically, most headers supported ASCII characters only. Currently, RFC 7578 suggest a way out to pass unicode filenames by percent-encoding the name.

So I would suggest to try adjusting JMeter code that creates Content-Disposition to match RFC 7578:

write(out, "Content-Disposition: form-data; name=\""); // $NON-NLS-1$
.

Do you think you could create such a pull request?

@vlsi
Copy link
Collaborator

vlsi commented Jun 15, 2023

For reference, HttpClient 4.x does not support Unicode filenames, and https://issues.apache.org/jira/browse/HTTPCLIENT-293 was integrated into 5.x only.

vlsi added a commit to vlsi/jmeter that referenced this issue Jun 15, 2023
vlsi added a commit to vlsi/jmeter that referenced this issue Jun 15, 2023
vlsi added a commit to vlsi/jmeter that referenced this issue Jun 15, 2023
vlsi added a commit to vlsi/jmeter that referenced this issue Jun 15, 2023
vlsi added a commit to vlsi/jmeter that referenced this issue Jun 15, 2023
vlsi added a commit to vlsi/jmeter that referenced this issue Jun 15, 2023
vlsi added a commit to vlsi/jmeter that referenced this issue Jun 15, 2023
@vlsi
Copy link
Collaborator

vlsi commented Jun 15, 2023

I've prepared a fix in #5987.
It would be great if someone could test it with their systems.

vlsi added a commit to vlsi/jmeter that referenced this issue Jun 15, 2023
vlsi added a commit to vlsi/jmeter that referenced this issue Jun 16, 2023
@vlsi vlsi closed this as completed in 13793b7 Jun 16, 2023
@vlsi vlsi modified the milestones: 5.7, 5.6 Jun 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants