如何忽略Golang中缺少冒号分隔符的http标头行

时间:2018-11-06 06:51:20

标签: http go

我在golang http服务器中遇到问题,其中客户端发送的HTTP请求的标头中包含无效参数。请求参数如下:

GET /a-53-qf21489190x38856_2/yy HTTP/1.1
Host: xxx.xxx.xxx.xxx:80
User-Agent: mot-w845
Connection: Keep-Alive
Profile: http://10.213.2.68
X-MDN9035445271
accept: application/vnd.wap.mms-message
accept-language: en
accept-charset: US-ASCII, ISO-8859-1, UTF-8

HTTP/1.1 400 Bad Request
Content-Type: text/plain; charset=utf-8
Connection: close

此处X-MDN9035445271不包含冒号(:)分隔符,因为此服务器返回了错误的请求。有什么方法可以忽略此类标头并正常处理请求。

0 个答案:

没有答案