gpt4 book ai didi

http - 使用 `Cannot mix POST with other methods` 时出现 `ab -p` 错误

转载 作者:可可西里 更新时间:2023-11-01 15:26:53 25 4
gpt4 key购买 nike

我正在使用 ApacheBench (ab) 对我的网站进行压力测试。当我指定方法 -m POST 和一些 postdata -p {datafile} 时,我收到消息

Cannot mix POST with other methods.

问题是我实际上并没有将 POST 与其他方法混合使用。这是我的完整命令:

ab -m POST -p postdata.txt -n 1000 -c 100 http://example.com/

最佳答案

这是由于 ab 处理命令行参数的方式的特殊性。当您使用 -p 时,它会自动为您将方法设置为 POST,这发生在 -m 被解析之前。所以当它解析-m时,它看到已经设置的方法不为null并抛出错误。它应该做的 (IMO) 是默默地忽略参数,如果它的值与隐式设置的值相同的话。

请注意,当您尝试执行 PUT 请求时,上述所有内容也适用;例如,ab -m PUT -u putdata.txt

因此,当您使用 -p- 时,您应该避免此错误的做法是永远不要指定 -m.

(来源:the ab.c source file)

关于http - 使用 `Cannot mix POST with other methods` 时出现 `ab -p` 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40794007/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com