Squid请求中的Squid - 400

时间:2017-01-04 10:43:51

标签: http squid

以下HTTP请求返回400 ERR_INVALID_REQ -

POST http://distservp1.pb.com/dstproduct.asp HTTP/1.1 
Proxy-Authorization: Basic Og==
Host: distservp1.pb.com
Connection: close
Content-type: application/x-www-form-urlencoded
Content-length: 638

PBXML=%3CSignonReq%3E%0D%0A%0...

回复(正文不包含其他信息) -

HTTP/1.0 400 Bad Request
Server: squid/2.7.STABLE8
Date: Wed, 04 Jan 2017 09:07:16 GMT
Content-Type: text/html
Content-Length: 2054
X-Squid-Error: ERR_INVALID_REQ 0
X-Cache: MISS from [ProxyName].local
X-Cache-Lookup: NONE from [ProxyName].local:8080
Via: 1.0 [ProxyName].local:8080 (squid/2.7.STABLE8)
Connection: close

查看数据包捕获,POST请求的主体在两个PDU中发送。在发送第二个PDU之前发回400 - 所以我想象错误在于头部。 Squid cache.log只显示 -

clientTryParseRequest: FD 20 (192.168.120.72:49503) Invalid Request

从chrome中的DHC插件生成的类似请求成功 -

POST http://distservp1.pb.com/dstproduct.asp HTTP/1.1
Host: distservp1.pb.com
Proxy-Connection: keep-alive
Content-Length: 638
Origin: chrome-extension://aejoelaoggembcahagimdiliamlcdmfm
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.87 Safari/537.36
Content-Type: application/x-www-form-urlencoded
Accept: */*
Accept-Encoding: gzip, deflate
Accept-Language: en-US,en;q=0.8

谁能看到这里出了什么问题?以及如何修复它的任何想法?我们无法修改发送请求的应用程序。它可以在未通过代理路由的设备上正常工作。

1 个答案:

答案 0 :(得分:0)

事实证明,有问题的应用程序是在请求行的末尾添加空格字符。这导致Squid拒绝它。