mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-07-11 22:03:01 -06:00
Core: Fixed issue with non-blocking HttpRequest and CRLF at the end of chunk
git-svn-id: svn://ultimatepp.org/upp/trunk@11066 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
parent
9f0ef04395
commit
3ef567b007
2 changed files with 13 additions and 5 deletions
|
|
@ -379,9 +379,14 @@ bool HttpRequest::Do()
|
|||
case CHUNK_BODY:
|
||||
if(ReadingBody())
|
||||
break;
|
||||
c1 = TcpSocket::Get();
|
||||
c2 = TcpSocket::Get();
|
||||
if(c1 != '\r' || c2 != '\n')
|
||||
StartPhase(CHUNK_CRLF);
|
||||
break;
|
||||
case CHUNK_CRLF:
|
||||
if(chunk_crlf.GetCount() < 2)
|
||||
chunk_crlf.Cat(TcpSocket::Get(2 - chunk_crlf.GetCount()));
|
||||
if(chunk_crlf.GetCount() < 2)
|
||||
break;
|
||||
if(chunk_crlf != "\r\n")
|
||||
HttpError("missing ending CRLF in chunked transfer");
|
||||
StartPhase(CHUNK_HEADER);
|
||||
break;
|
||||
|
|
@ -692,6 +697,7 @@ void HttpRequest::ReadingChunkHeader()
|
|||
}
|
||||
count += n;
|
||||
StartPhase(CHUNK_BODY);
|
||||
chunk_crlf.Clear();
|
||||
break;
|
||||
}
|
||||
if(c != '\r')
|
||||
|
|
@ -894,6 +900,7 @@ String HttpRequest::GetPhaseName() const
|
|||
"Receiving content",
|
||||
"Receiving chunk header",
|
||||
"Receiving content chunk",
|
||||
"Receiving content chunk ending",
|
||||
"Receiving trailer",
|
||||
"Request with continue",
|
||||
"Waiting for continue header",
|
||||
|
|
|
|||
|
|
@ -414,7 +414,8 @@ class HttpRequest : public TcpSocket {
|
|||
|
||||
Stream *poststream;
|
||||
int64 postlen;
|
||||
|
||||
|
||||
String chunk_crlf;
|
||||
|
||||
void Init();
|
||||
|
||||
|
|
@ -557,7 +558,7 @@ public:
|
|||
BEGIN, START, DNS,
|
||||
SSLPROXYREQUEST, SSLPROXYRESPONSE, SSLHANDSHAKE,
|
||||
REQUEST, HEADER, BODY,
|
||||
CHUNK_HEADER, CHUNK_BODY, TRAILER,
|
||||
CHUNK_HEADER, CHUNK_BODY, CHUNK_CRLF, TRAILER,
|
||||
FINISHED, FAILED,
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue