【发布时间】:2018-01-13 21:18:02
【问题描述】:
我想知道是否有人对我在通过 casperJS 发送 POST 请求时几乎一直遇到的以下错误有任何经验。
this.open('https://'+host+'/test.php?test=new1', {
method: 'post',
data: {
'host':hostID,
'func':'newjob',
'apikey': key,
'test':testing
}
})
带有以下推理的错误 400 非常神秘,并且没有参考 Squid 文档中的错误。
1515876312.758 0 10.2.1.101 NONE/400 4272 CONNECT 错误:双 CR - NONE/- text/html 1515876312.775 0 10.2.1.101 无/400 4270 连接错误:双 CR-无/-文本/html 1515876312.811 0 10.2.1.101 无/400 4272 连接错误:双 CR-无/-文本/html 1515876312.814 0 10.2.1.101 无/400 4270 连接错误:双 CR-无/-文本/html 1515876312.852 0 10.2.1.101 无/400 4272 连接错误:双 CR-无/-文本/html 1515876312.967 0 10.2.1.101 NONE/400 4235 CONNECT 错误:双 CR - NONE/- text/html 1515876314.258 0 10.2.1.101 NONE/400 4296 CONNECT 错误:双 CR - NONE/- text/html 1515876314.329 0 10.2.1.101 无/400 4296 连接错误:双 CR-无/-文本/html 1515876314.368 0 10.2.1.101 NONE/400 4296 CONNECT 错误:双 CR - NONE/- text/html 1515876314.672 0 10.2.1.101 无/400 4351 连接错误:双 CR-无/-文本/html 1515876314.738 0 10.2.1.101 NONE/400 4351 CONNECT 错误:双 CR - NONE/- text/html 1515876314.773 0 10.2.1.101 无/400 4281 连接错误:双 CR-无/-文本/html 1515876314.777 0 10.2.1.101 NONE/400 4351 CONNECT 错误:双 CR - NONE/- text/html 1515876314.829 0 10.2.1.101 NONE/400 4281 CONNECT 错误:双 CR - NONE/- text/html
CasperJS 发出的输出是:
[info] [phantom] Starting...
[info] [phantom] Running suite: 1 step
Using UA=Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_8; de-at) AppleWebKit/533.21.1 (KHTML, like Gecko) Version/5.0.5 Safari/533.21.1
[info] [phantom] Step anonymous 1/1: done in 52ms.
[info] [phantom] Step anonymous 2/3: done in 67ms.
[warning] [phantom] Loading resource failed with status=fail: https://10.2.1.199/test.php?test=new1
我查看了这个 SO Q/A:he following HTTP request returns a 400 ERR_INVALID_REQ -
这似乎是相似的,但如果它们在问题中存在联系 - 有没有人知道如何让 CasperJS/phantomJS 不添加空格?
【问题讨论】:
-
我不熟悉 squid 代理,但是您确定您在请求中提供了所有必需的标头吗?
标签: post casperjs squid http-status-code-400