How to verify AB responses?

Alexey picture Alexey · Aug 3, 2015 · Viewed 19.4k times · Source

Is there a way to make sure that AB gets proper responses from server? For example:

  • To force it to output the response of a single request to STDOUT OR
  • To ask it to check that some text fragment is included into the response body

I want to make sure that authentication worked properly and i am measuring response time of the target page, not the login form.

Currently I just replace ab -n 100 -c 1 -C "$MY_COOKIE" $MY_REQUEST with curl -b "$MY_COOKIE" $MY_REQUEST | lynx -stdin .

If it's not possible, is there an alternative more comprehensive tool that can do that?

Answer

Nick Pyett picture Nick Pyett · May 1, 2018

You can use the -v option as listed in the man doc:

-v verbosity Set verbosity level - 4 and above prints information on headers, 3 and above prints response codes (404, 200, etc.), 2 and above prints warnings and info.

https://httpd.apache.org/docs/2.4/programs/ab.html

So it would be:

ab -n 100 -c 1 -C "$MY_COOKIE" -v 4 $MY_REQUEST

This will spit out the response headers and HTML content. The 3 value will be enough to check for a redirect header.

I didn't try piping it to Lynx but grep worked fine.