今天用HttpWebRequest,发生了异常,
提示服务器提交了协议冲突 Section=ResponseStatusLine
经过抓包发现如下交互:
POST /service.ep HTTP/1.1
Content-Type: application/x-www-form-urlencoded;charset=utf-8
User-Agent: Mozilla/4.0 (compatible; MSIE 5.00; Windows 98)
Host: 127.0.0.1:10900
Content-Length: 393
Expect: 100-continue
Connection: Keep-Alive
servic............%3e
====================
锘縃TTP/1.1 200 OK
Content-Type: text/html; charset=utf-8
Content-Length: 269
Connection: close
632836355380156250796096
7a46182a03213ed07bad242e2ff4e696
.....
===========
注意:锘縃TTP/1.1 200 OK,原来是服务器返回不对.怪不得.
估计是服务器:用了UTF8编码
并且UTF8返回:GetPreamble() == byte[] { 0xef, 0xbb, 0xbf };