Core: Fixed issue with HttpRequest chunked trailer

git-svn-id: svn://ultimatepp.org/upp/trunk@9698 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
cxl 2016-04-17 06:57:41 +00:00
parent feb36c2892
commit 5c2a636000
2 changed files with 19 additions and 1 deletions

View file

@ -383,7 +383,7 @@ bool HttpRequest::Do()
StartPhase(CHUNK_HEADER);
break;
case TRAILER:
if(ReadingHeader())
if(ReadingTrailer())
break;
header.ParseAdd(data);
Finish();
@ -665,6 +665,23 @@ bool HttpRequest::ReadingHeader()
}
}
bool HttpRequest::ReadingTrailer()
{
for(;;) {
int c = TcpSocket::Get();
if(c < 0)
return !IsEof();
else
data.Cat(c);
if(data.GetCount() == 2) {
if(data[0] == '\r' && data[1] == '\n')
return false;
HttpError("Invalid chunk trailer");
return true;
}
}
}
void HttpRequest::ReadingChunkHeader()
{
for(;;) {

View file

@ -400,6 +400,7 @@ class HttpRequest : public TcpSocket {
bool SendingData(bool request = false);
bool ReadingHeader();
bool ReadingTrailer();
void StartBody();
bool ReadingBody();
void ReadingChunkHeader();