两周没写东西了,主要是在学习一点C,参考 webbench 写了个工具。刚刚写完,也不知道好不好用,同学们有兴趣也帮我测一测,提点意见。
项目位于 https://github.com/heiing/hb
克隆下来后,使用 make 编译即可。
./hb [OPTIONS] URL
OPTIONS:
-h | --help Print this information and exit.
-v | --version Display program version and exit.
-c | --clients <n> Run <n> clients, default one.
-t | --time <second> Run <second> seconds, default 30.
-m | --method <n> Use HTTP method, default GET:
GET,POST,PUT,DELETE,HEAD,TRACE,PATCH
PROPFIND,COPY,MOVE
-p | --protocol <n> Use HTTP protocol, default 2:\n"
0 - HTTP/0.9
1 - HTTP/1.0
2 - HTTP/1.1
-f | --file <path> Use file for POST/PUT method.
-P | --proxy <server:port> Use proxy for request.
示例:
./hb -m POST -f postdata.txt http://example.com/foo
name=hb&version=0.0.1
User-Agent: my agent 1.0
Content-Type: application/x-www-form-urlencoded
Cookie: PHPSESSID=1234567890123456
name=hb&version=0.0.1