about httest
In short , httest is HTTP related testing tools. You can do request and response validation testing , file upload , web sockets , load testing , client and server simulation etc with httest.
[ install httest on Fedora 18 including trial and error logs ]
[root@f18 ~]# cat /etc/fedora-release
Fedora release 18 (Spherical Cow)
[root@f18 ~]# uname -ri
3.9.4-200.fc18.x86_64 x86_64
[root@f18 ~]# gcc --version
gcc (GCC) 4.7.2 20121109 (Red Hat 4.7.2-8)
|
The following is a dependency list to build httest
INSTALL INSTRUCTIONS
--------------------
Prerequisits:
* libapr-1
* libapr-util-1
* libpcre
* libssl
Optional:
* liblua (5.1 or 5.2)
|
In my fedora box , I have already installed httpd via “yum install httpd”
[root@f18 hattori]# tar xzvf httest-2.4.3.tar.gz
[root@f18 hattori]# cd httest-2.4.3/
|
compile.
error
[root@f18 httest-2.4.3]# ./configure
checking for select... yes
checking for socket... yes
./configure: line 12097: apr-1-config: command not found
libapr is missing
|
[root@f18 httest-2.4.3]# yum install -y libapreq2 libapreq2-devel
|
try again.
[root@f18 httest-2.4.3]# ./configure
checking for select... yes
checking for socket... yes
./configure: line 12107: pcre-config: command not found
libpcre is missing
|
[root@f18 httest-2.4.3]# yum install pcre-devel
|
okay.
# ./configure
config.status: creating plugins/xemacs/Makefile
config.status: creating test/Makefile
config.status: creating config/config.h
config.status: executing depfiles commands
config.status: executing libtool commands
#
|
nnn , error
[root@f18 httest-2.4.3]# make
Making all in src
make[1]: Entering directory `/home/hattori/httest-2.4.3/src'
gcc -DHAVE_CONFIG_H -I. -I../config -DLINUX=2 -D_REENTRANT -D_GNU_SOURCE -pthread -g -O2 -I/usr/include/apr-1 -I/usr/include/apr-1 -c httest.c
httest.c:37:25: fatal error: openssl/ssl.h: No such file or directory
compilation terminated.
make[1]: *** [httest.o] Error 1
make[1]: Leaving directory `/home/hattori
|
[root@f18 httest-2.4.3]# yum install -y openssl-devel
|
try again
okay , I was able to build httest.
# make
# make install
|
[root@f18 httest-2.4.3]# /usr/local/bin/httest --version
httest 2.4.3
Copyright (C) 2006 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Written by Christian Liesch
|
[ sample usage ]
there is a PDF manual and sample configurations from http://htt.sourceforge.net/cgi-bin/cwiki/bin/public?page=HttDocumentation
httest box ( 192.168.11.100 ) ----- httpd ( 192.168.11.53 )
make a script file
on the httest box
# cat load1.txt
CLIENT
_REQ 192.168.11.53 80
__GET / HTTP/1.1
__Host: foo.bar
__
_WAIT
END
|
run httest
[root@f18 hattori]# /usr/local/bin/httest -d load1.txt
run load1.txt
CLT0-0 start ...
_REQ 192.168.11.53 80
__GET /index.html HTTP/1.1
__Host: foo.bar
__
_EXPECT . "200 OK"
_WAIT
>GET /index.html HTTP/1.1
>Host: foo.bar
>
<HTTP/1.1 200 OK
<Date: Tue, 04 Jun 2013 18:01:34 GMT
<Server: Apache/2.4.4 (Fedora)
<Last-Modified: Tue, 04 Jun 2013 17:57:15 GMT
<ETag: "6-4de57cfbf3f88"
<Accept-Ranges: bytes
<Content-Length: 6
<Content-Type: text/html; charset=UTF-8
<
<hello
OK
|
capture data which was collected on httpd box.
[root@localhost ~]# tshark -i eth0 port 80
Running as user "root" and group "root". This could be dangerous.
Capturing on eth0
0.000000 192.168.11.100 -> 192.168.11.53 TCP 74 44962 > http [SYN] Seq=0 Win=14600 Len=0 MSS=1460 SACK_PERM=1 TSval=13643465 TSecr=0 WS=128
0.000134 192.168.11.53 -> 192.168.11.100 TCP 74 http > 44962 [SYN, ACK] Seq=0 Ack=1 Win=14480 Len=0 MSS=1460 SACK_PERM=1 TSval=11353062 TSecr=13643465 WS=128
0.000297 192.168.11.100 -> 192.168.11.53 TCP 66 44962 > http [ACK] Seq=1 Ack=1 Win=14720 Len=0 TSval=13643465 TSecr=11353062
0.000544 192.168.11.100 -> 192.168.11.53 TCP 90 [TCP segment of a reassembled PDU]
0.000609 192.168.11.53 -> 192.168.11.100 TCP 66 http > 44962 [ACK] Seq=1 Ack=25 Win=14592 Len=0 TSval=11353062 TSecr=13643465
0.000653 192.168.11.100 -> 192.168.11.53 TCP 68 [TCP segment of a reassembled PDU]
0.000699 192.168.11.53 -> 192.168.11.100 TCP 66 http > 44962 [ACK] Seq=1 Ack=27 Win=14592 Len=0 TSval=11353062 TSecr=13643465
0.000722 192.168.11.100 -> 192.168.11.53 TCP 79 [TCP segment of a reassembled PDU]
0.000740 192.168.11.53 -> 192.168.11.100 TCP 66 http > 44962 [ACK] Seq=1 Ack=40 Win=14592 Len=0 TSval=11353062 TSecr=13643465
0.000760 192.168.11.100 -> 192.168.11.53 TCP 68 [TCP segment of a reassembled PDU]
0.000776 192.168.11.53 -> 192.168.11.100 TCP 66 http > 44962 [ACK] Seq=1 Ack=42 Win=14592 Len=0 TSval=11353062 TSecr=13643465
0.000795 192.168.11.100 -> 192.168.11.53 HTTP 68 GET /index.html HTTP/1.1
0.000811 192.168.11.53 -> 192.168.11.100 TCP 66 http > 44962 [ACK] Seq=1 Ack=44 Win=14592 Len=0 TSval=11353062 TSecr=13643465
0.001442 192.168.11.53 -> 192.168.11.100 HTTP 311 HTTP/1.1 200 OK (text/html)
0.001542 192.168.11.100 -> 192.168.11.53 TCP 66 44962 > http [ACK] Seq=44 Ack=246 Win=15744 Len=0 TSval=13643466 TSecr=11353063
0.002032 192.168.11.100 -> 192.168.11.53 TCP 66 44962 > http [FIN, ACK] Seq=44 Ack=246 Win=15744 Len=0 TSval=13643467 TSecr=11353063
0.002441 192.168.11.53 -> 192.168.11.100 TCP 66 http > 44962 [FIN, ACK] Seq=246 Ack=45 Win=14592 Len=0 TSval=11353064 TSecr=13643467
0.002581 192.168.11.100 -> 192.168.11.53 TCP 66 44962 > http [ACK] Seq=45 Ack=247 Win=15744 Len=0 TSval=13643467 TSecr=11353064
|
silent mode ( -s = silent , -T = timestamp )
[root@f18 hattori]#
[root@f18 hattori]# /usr/local/bin/httest -Ts load1.txt
Wed Jun 05 03:03:31 2013 run load1.txt OK
|
there are sample configurations under /httest-x.x.x/examples directory
[root@f18 examples]# pwd
/home/hattori/httest-2.4.3/examples
[root@f18 examples]# ls
auto_cookie.htt macro_post.htt ntlm2.htt transfertypes.htt
clientserver.htt Makefile ntlm2sess.htt websocket_client.htt
concurrent.htt Makefile.am ntlm.htt websocket_html.htt
include.htt Makefile.in simple.htt
macro_get.htt matchexec.htt ssl.htt
|
[root@f18 hattori]# cat load2.txt
# 1000 concurrent clients, loop 50000 times each client
CLIENT 1000 50000
_REQ 192.168.11.53 80
__GET /index.html HTTP/1.1
__Host: foo.bar
__User-Agent: mozilla
__
_WAIT
END
|
syslog on httpd box. sending syn cookies.
Jun 5 03:06:16 localhost kernel: [11877.923678] TCP: TCP: Possible SYN flooding on port 80. Sending cookies. Check SNMP counters.
Jun 5 03:07:54 localhost kernel: [11975.438593] net_ratelimit: 272 callbacks suppressed
|
The most samples can be found in the /httest-x.x.x/test directory
ReplyDeleteand
CLIENT 1000 50000
does only run 1000 concurrent clients, no looping, the 50000 is just drop. If you like to loop do the following:
CLIENT 1000
_AUTO_CLOSE on
_LOOP 50000
# yourscript
_END
_END