fix tc_http parse header bug

This commit is contained in:
ruanshudong 2020-07-07 23:00:04 +08:00
parent ebaa1ebfa0
commit 626fd86131
2 changed files with 15 additions and 1 deletions

View File

@ -50,6 +50,20 @@ TEST_F(HttpTest, testCheckRequestURL) //此时使用的是TEST_F宏
ASSERT_TRUE(req.getURL().getDomain() == "www.qq.com");
}
TEST_F(HttpTest, testHttp) //此时使用的是TEST_F宏
{
TC_HttpRequest stHttpReq;
stHttpReq.setCacheControl("no-cache");
stHttpReq.setGetRequest("http://118.89.197.217/", true);
TC_HttpResponse stHttpRsp;
int ret = stHttpReq.doRequest(stHttpRsp, 3000);
cout << ret << ":" << stHttpRsp.getContent() << endl;
cout << "\n\n==============================\n" << stHttpRsp.getContent().size() << endl;
cout << stHttpRsp.genHeader() << endl;
}
TEST_F(HttpTest, testEncodeString) //此时使用的是TEST_F宏
{
string s = string("GET /a/b?name=value&ccc=ddd HTTP/1.1\r\n")

View File

@ -1182,7 +1182,7 @@ bool TC_HttpResponse::incrementDecode(TC_NetWorkBuffer &buff)
_headLength = p - data.first + 4;
_iTmpContentLength = parseResponseHeaderString(data.first, data.first + data.second);
_iTmpContentLength = parseResponseHeaderString(data.first, data.first + _headLength);
//304的返回码中头里本来就没有Content-Length也不会有数据体头收全了就是真正的收全了
if ( (204 == _status) || (304 == _status) )