How to send multiple query strings in Apache Bench?

ab -n 1 -c 1 http: // localhost: 2020 / welTo.do? pxtId = 3000007937 & superDo = jack

I got an answer for the first line of the query, but also getting

'superDo' is not recognized as an internal or external command, operating program, or batch file.

Please help me

TIA

Relationship Thiru

+8
benchmarking apache apachebench
source share
3 answers

You probably just need to provide a URL in order not to interpret special shell characters. In this case, your & character causes text to the left in the background when you try to run superDo as a command.

  ab -n 1 -c 1 'http://localhost:2020/welTo.do?pxtId=3000007937&superDo=jack' 
+16
source share

There are two workarounds for this:

  1. You can use double quotation marks to surround the URL:

ab -n 1 -c 1 " http: // localhost: 2020 / welTo.do? pxtId = 3000007937 & superDo = jack "

  1. Escape "&" with backslash:

ab -n 1 -c 1 http: // localhost: 2020 / welTo.do? pxtId = 3000007937 \ & superDo = jack

+4
source share

Have you tried the zip file? think this should work:

ab -n 1 -c 1 -p postfile.txt -T 'application / x-www-form-urlencoded' http: // localhost: 2020 / welTo.do

And then create a flat file called postfile.txt with content like this:

 pxtId=3000007937&superDo=jack 

Example adapted from here

+3
source share

All Articles