本文介绍了鱿鱼 - 在POST请求400的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

以下HTTP请求返回400 ERR_INVALID_REQ -

The following HTTP request returns a 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...

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

The response (body contains no additional information)-

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只显示 -

Looking at a packet capture the body of the POST request is sent in two PDUs. The 400 is sent back before the second PDU is sent - so I would imagine the error lies int he headers. The Squid cache.log just shows -

clientTryParseRequest: FD 20 (192.168.120.72:49503) Invalid Request

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

A similar request generated from the DHC plugin in chrome succeeds -

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

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

Can anyone see what is going wrong here? And any ideas on how to fix it? We are not able to modify the application which is sending the request. It works fine on a device not routed through the proxy.

推荐答案

原因是有问题的应用程序正在添加一个空格字符。请求行的结尾。这导致Squid拒绝它。

Turns out the application in question is adding a space character at the end of the request line. This causes Squid to reject it.

这篇关于鱿鱼 - 在POST请求400的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-21 07:45