Core: HttpRequest added BEGIN phase

git-svn-id: svn://ultimatepp.org/upp/trunk@4793 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
cxl 2012-04-16 16:14:18 +00:00
parent 994ab898db
commit 1c7292e6fc
3 changed files with 7 additions and 5 deletions

View file

@ -29,7 +29,7 @@ void HttpRequest::Init()
std_headers = true;
hasurlvar = false;
method = METHOD_GET;
phase = START;
phase = BEGIN;
redirect_count = 0;
retry_count = 0;
gzip = false;
@ -222,10 +222,11 @@ bool HttpRequest::Do()
{
int c1, c2;
switch(phase) {
case START:
case BEGIN:
retry_count = 0;
redirect_count = 0;
start_time = msecs();
case START:
Start();
break;
case DNS:
@ -304,7 +305,7 @@ bool HttpRequest::Do()
if(retry_count++ < max_retries) {
LLOG("HTTP retry on error " << GetErrorDesc());
start_time = msecs();
Start();
StartPhase(START);
}
}
return phase != FINISHED && phase != FAILED;
@ -663,6 +664,7 @@ String HttpRequest::Execute()
String HttpRequest::GetPhaseName() const
{
static const char *m[] = {
"Initial state",
"Start",
"Resolving host name",
"SSL proxy request",

View file

@ -397,7 +397,7 @@ public:
void ClearContent() { body.Clear(); }
enum Phase {
START, DNS,
BEGIN, START, DNS,
SSLPROXYREQUEST, SSLPROXYRESPONSE, SSLHANDSHAKE,
REQUEST, HEADER, BODY,
CHUNK_HEADER, CHUNK_BODY, TRAILER,

View file

@ -806,7 +806,7 @@ bool TcpSocket::StartSSL()
SetSockError("StartSSL", -1, "Socket is not open");
return false;
}
if(!IsOpen()) {
if(mode != CONNECT && mode != ACCEPT) {
SetSockError("StartSSL", -1, "Socket is not connected");
return false;
}