14

I'm trying to use ab to test my webserver, but it only supports HTTP/1.1 (reject requests that have HTTP/1.0 in the first line). The -k switch only adds a header with connection: keep-alive.

Is it possible to make ab send HTTP/1.1 request?

Wei Shi
  • 243

3 Answers3

5

how about using Siege, it is as easy to use as ab, but it supports HTTP/1.1:

http://www.joedog.org/index/siege-home

3

A way found in CMU's 15-441:

perl -pi -e 's/HTTP\/1.0/HTTP\/1.1/g' /usr/bin/ab

Hacky, but it works! :D

ch271828n
  • 153
0

here my optimization based on @ch271828n and @likebike

sed 's|HTTP/1.0|HTTP/1.1|g' /usr/bin/ab >ab-http11
chmod +x ab-http11
./ab-http11 -V
./ab-http11 -l -n 6 -c 2 -v 2  "https://mytestapp.com/test123"

btw without HTTP1.1 got HTTP/1.1 426 Upgrade Required when testing behind Envoy proxy

see also here: https://github.com/envoyproxy/envoy/issues/18608

Tilo
  • 146