如何为apachebench(http)添加http代理 [英] How to add http proxy for apachebench(ab)

查看:121
本文介绍了如何为apachebench(http)添加http代理的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想抓取ab发送或接收的http数据包.

I want to grab http packets which ab sends or receives.

因此,我在shell命令中添加了 http_proxy :

So I add a http_proxy in shell command:

$ export http_proxy=127.0.0.1:8888

然后我执行ab命令:

$ ab -c 1 -n 1 http://localhost/

最后,我的代理(127.0.0.1:8888)无法从ab获取http数据包.

Finally, my proxy(127.0.0.1:8888) failed to get http packets from ab.

有什么方法可以让ab通过http_proxy访问http?

这是我的环境: Mac OSX 10.10.3

推荐答案

如果您了解ab的帮助ab -h,您会发现它支持代理选项-X:

If you read about ab's help ab -h, you'll find that it supports an proxy option -X:

-X proxy:port   Proxyserver and port number to use

此选项等效于curl-x:

-x, --proxy [PROTOCOL://]HOST[:PORT]  Use proxy on given port

它会导致以下命令:

ab -c 1 -n 1 -X 127.0.0.1:8888 http://localhost/

这篇关于如何为apachebench(http)添加http代理的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆