Bug 56161 - Data is corrupted on PUT request when not using 100-continue
Summary: Data is corrupted on PUT request when not using 100-continue
Status: NEW
Alias: None
Product: JMeter - Now in Github
Classification: Unclassified
Component: HTTP (show other bugs)
Version: 2.11
Hardware: PC Linux
: P2 normal (vote)
Target Milestone: ---
Assignee: JMeter issues mailing list
Depends on:
Reported: 2014-02-19 16:04 UTC by jharden
Modified: 2014-02-19 16:04 UTC (History)
1 user (show)

JMeter workbench (1.45 KB, text/plain)
2014-02-19 16:04 UTC, jharden

Note You need to log in before you can comment on or make changes to this bug.
Description jharden 2014-02-19 16:04:18 UTC
Created attachment 31334 [details]
JMeter workbench

If I set up jmeter to use an HTTP Test Script Recorder and then use JMeter as a proxy for a PUT request which does not use the Expect: 100-continue mechanism then the data of the image is corrupted. I sent an email to the users list which is in the archive but doesn't appear to have been sent to the list (neither I (who had subscribed prior to sending) nor my colleague, who has been subscribed for a long time, got the email), the content of which was as follows:


We're playing around with JMeter at the moment and wanted to sit JMeter
between our test code and our backend HTTP service. We wanted to use
JMeter to record all the tests that were performed but when we enable
JMeter as an HTTP Proxy for our tests when a PUT request is made to
upload an image the binary image data going into JMeter (which has an
HTTP header Content-Type: image/jpeg) is considerably changed inside

I stuck a Charles proxy between the tests and JMeter and then between
JMeter and the backend so I could see exactly what went in and what came
out. I get the following results:

The Request headers (I'll not include the binary, but a hexdump of the
binary shows it to be malformed on exit) from our tests going into

Content-Length: 6504
Content-Type: image/jpeg
Accept-Encoding: gzip, deflate, compress
Accept: */*
User-Agent: python-requests/2.2.1 CPython/2.7.6 Linux/3.12-1-amd64

The request headers which JMeter sends:

PUT /image/abc HTTP/1.1
Connection: keep-alive
Content-Type: image/jpeg
Accept: */*
User-Agent: python-requests/2.2.1 CPython/2.7.6 Linux/3.12-1-amd64
Accept-Encoding: gzip, deflate, compress
Content-Length: 11261

You can see the Content-Length is totally different and so our tests
break when a following GET request doesn't get back the same data.

I'm using JMeter 2.11 (downloaded from the JMeter website) on Debian

In JMeter we've done the following:

1) Added an HTTP(S) Test Script Recorder to a blank WorkBench
2) Changed the Port number to 58081
3) Clicked start

Then we run our tests and get the results above.

Based on a bunch of searches we tried the following things which didn't

1) Set the HTTP Sampler Settings->Type to Java
2) Added a BSF Post Processing element to the Recorder with the
following script: 'prev.setDataEncoding("UTF-8")'

I'm now totally stumped, any suggestions as to a fix would be greatly
appreciated, heck even just knowing what I'm doing is stupid would be
awesome so I can go down a different route!

If it looks like a bug I could boil down exactly what's happening to a
tiny script and submit it as a bug report.



Since then I have further narrowed down that using the 100-continue mechanism means data will be correctly passed through the recorder.

I used the following curl command to test this:

http_proxy= curl -v -H "Expect: " -H "Content-Type: image/jpeg" -T cat.jpeg

If I don't overwrite the expect header then the request works exactly as expected and the data is not corrupted (as was shown in the email referenced above).

Attached is the jmx file for the extremely simple Workbench I've got set up.


Comment 1 The ASF infrastructure team 2022-09-24 20:37:56 UTC
This issue has been migrated to GitHub: https://github.com/apache/jmeter/issues/3321