mirror of
https://gitee.com/TarsCloud/TarsCpp.git
synced 2025-01-05 17:42:24 +08:00
fix tc_http parse header bug
This commit is contained in:
parent
ebaa1ebfa0
commit
626fd86131
@ -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")
|
||||
|
@ -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) )
|
||||
|
Loading…
Reference in New Issue
Block a user