Skip to content

Commit

Permalink
Merge pull request #261 from wincsb/master
Browse files Browse the repository at this point in the history
Fixed the HTTP client crash when compiling with SSL and the unusable …
  • Loading branch information
ruanshudong authored Nov 7, 2022
2 parents 816a4b5 + 8abf0f2 commit 6f6aa45
Showing 1 changed file with 22 additions and 17 deletions.
39 changes: 22 additions & 17 deletions util/src/tc_http.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "util/tc_http.h"
#include "util/tc_http.h"
#include "util/tc_port.h"
#include "util/tc_common.h"
#include "util/tc_clientsocket.h"
Expand Down Expand Up @@ -2258,36 +2258,41 @@ int TC_HttpRequest::doRequest(const string &sSendBuffer, TC_TCPClient &tcpClient

iRet = tcpClient.recv(recvBuffer->free(), iRecvLen);

if (iRet != TC_ClientSocket::EM_SUCCESS)
{
return iRet;
}

#if TARS_SSL
iRet = ssl->read(recvBuffer->free(), iRecvLen, in);
if (iRet != 0)
if (iRet == TC_ClientSocket::EM_SUCCESS)
{
return iRet;
}
if(this->_httpURL._iURLType == TC_URL::HTTPS)
{
#if TARS_SSL
iRet = ssl->read(recvBuffer->free(), iRecvLen, in);
if (iRet != 0)
{
return iRet;
}

rbuf = ssl->recvBuffer();
rbuf = ssl->recvBuffer();
#else
if (iRet == TC_ClientSocket::EM_SUCCESS)
{
recvBuffer->addWriteIdx(iRecvLen);
}
return TC_ClientSocket::EM_HTTPS;

#endif
}
else
{
recvBuffer->addWriteIdx(iRecvLen);

}
}

switch (iRet)
{
case TC_ClientSocket::EM_SUCCESS:
if (stHttpRsp.incrementDecode(*rbuf))
if (stHttpRsp.incrementDecode(*rbuf->getBuffer()))
{
return TC_ClientSocket::EM_SUCCESS;
}
continue;
case TC_ClientSocket::EM_CLOSE:
stHttpRsp.incrementDecode(*rbuf);
stHttpRsp.incrementDecode(*rbuf->getBuffer());
return TC_ClientSocket::EM_SUCCESS;
default:
return iRet;
Expand Down

0 comments on commit 6f6aa45

Please sign in to comment.