interrupt socket receive when header is too long.

This commit is contained in:
wyy 2014-09-16 21:53:33 +08:00
parent 198c483c66
commit 49e3a1760f
2 changed files with 6 additions and 2 deletions

View File

@ -80,7 +80,7 @@ namespace Husky
_contentLength = 0; _contentLength = 0;
} }
public: public:
bool parseHeaders(const char* buffer, size_t len) bool parseHeader(const char* buffer, size_t len)
{ {
string headerStr(buffer, len); string headerStr(buffer, len);
size_t lpos = 0, rpos = 0; size_t lpos = 0, rpos = 0;

View File

@ -82,7 +82,11 @@ namespace Husky
{ {
if(!httpInfo.isHeaderFinished()) if(!httpInfo.isHeaderFinished())
{ {
httpInfo.parseHeaders(recvBuf, n); if(!httpInfo.parseHeader(recvBuf, n))
{
LogError("parseHeader failed. ");
return false;
}
continue; continue;
} }
httpInfo.appendBody(recvBuf, n); httpInfo.appendBody(recvBuf, n);