update receive

This commit is contained in:
wyy 2014-09-15 19:01:04 +08:00
parent fbbcfbdec7
commit 38af4a5fb6

View File

@ -78,7 +78,7 @@ namespace Husky
{ {
char recvBuf[RECV_BUFFER_SIZE]; char recvBuf[RECV_BUFFER_SIZE];
int n; int n;
while((n = recv(sockfd, recvBuf, RECV_BUFFER_SIZE, 0)) > 0) while(!httpInfo.isBodyFinished() && (n = recv(sockfd, recvBuf, RECV_BUFFER_SIZE, 0)) > 0)
{ {
if(!httpInfo.isHeaderFinished()) if(!httpInfo.isHeaderFinished())
{ {
@ -86,11 +86,6 @@ namespace Husky
continue; continue;
} }
httpInfo.appendBody(recvBuf, n); httpInfo.appendBody(recvBuf, n);
if(!httpInfo.isBodyFinished())
{
continue;
}
break;
} }
if(n < 0) if(n < 0)
{ {