Reputation: 1344
I am trying to perform an HTTP(s) request in a Jmeter test plan using the OS Process Sampler, but I am getting an error on one of the curl parameters. I am running Jmeter on a Windows machine.
Here is the original curl command, which works if I run it from the command line:
curl -k -L -b .\cookies -c .\cookies -E h:\curl\EXP\curl\bin\publicCert.pem.crt --key H:\curl\EXP\curl\bin\privateKey.pem.key https://myhost.foo.com//xxx.cgi?encreply=xxxxxxxxx
The error that I am seeing in Jmeter is:
curl: option --key H:\curl\EXP\curl\bin\privateKey.pem.key: is unknown
curl: try 'curl --help' or 'curl --manual' for more information
I think (but am not sure) that the problem is that Jmeter seems to not like the "--key" parameter, maybe because of the 2 dashes ("--").
The reason I am guessing that is that earlier, I had problem with the parameter for the certificate, which was "--cert" and I was able to eliminate that earlier problem by changing to the "-E" parameter, which has a single dash.
Unfortunately, there doesn't seem to be a single-dash parameter for the key file.
Can someone tell me why I am getting that error when I try to run the curl under Jmeter, but it is ok when I run the curl from the command line?
Thanks!
P.S. FYI, the reason I am trying to send the request via the OS Process Sampler instead of the HTTP request is that the URI has some characters that are causing the HTTP Request step to throw a URI exception. I cannot encode that URI because it has some kind of hash and if I encode the URL, that causes the has to be bad on the server-side, so I am trying to see if I can substitute using the OS Process Sampler.
Upvotes: 2
Views: 1101
Reputation: 168092
Option 1
Well-behaved JMeter test must be doing what real user is doing, in particular your case my expectation is that you're launching curl from CMD or Powershell
So my expectation is that you should amend your configuration to look like:
Option 2
If you're planning to perform a HTTP request my expectation is that the most obvious choice is using HTTP Request sampler.
You can simply record your CURL call using JMeter's HTTP(S) Test Script Recorder, curl can be configured to user JMeter's proxy via -x
command-line option like:
curl -x http://localhost:8888 -k -L -b .\cookies -c .\cookies ......
With regards to passing client-side certificate using JMeter - it can be done using SSL Manager or system properties.
Option 3
Be aware that in 99% of cases it's easier to use JSR223 Sampler in order to execute an arbitrary OS command, the syntax would be something like:
return "your command here".execute().text
Demo (I print the output to jmeter.log file to instead of returning it as a Sample Result):
Upvotes: 2