mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-07-11 22:03:01 -06:00
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:
parent
feb36c2892
commit
5c2a636000
2 changed files with 19 additions and 1 deletions
|
|
@ -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(;;) {
|
||||
|
|
|
|||
|
|
@ -400,6 +400,7 @@ class HttpRequest : public TcpSocket {
|
|||
bool SendingData(bool request = false);
|
||||
|
||||
bool ReadingHeader();
|
||||
bool ReadingTrailer();
|
||||
void StartBody();
|
||||
bool ReadingBody();
|
||||
void ReadingChunkHeader();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue