From 1c7292e6fcd1b831342fe304b54090142a417840 Mon Sep 17 00:00:00 2001 From: cxl Date: Mon, 16 Apr 2012 16:14:18 +0000 Subject: [PATCH] Core: HttpRequest added BEGIN phase git-svn-id: svn://ultimatepp.org/upp/trunk@4793 f0d560ea-af0d-0410-9eb7-867de7ffcac7 --- uppsrc/Core/Http.cpp | 8 +++++--- uppsrc/Core/Inet.h | 2 +- uppsrc/Core/Socket.cpp | 2 +- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/uppsrc/Core/Http.cpp b/uppsrc/Core/Http.cpp index 135e3dd63..ffeb273b3 100644 --- a/uppsrc/Core/Http.cpp +++ b/uppsrc/Core/Http.cpp @@ -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", diff --git a/uppsrc/Core/Inet.h b/uppsrc/Core/Inet.h index 0ef2c5a8d..0b9df1151 100644 --- a/uppsrc/Core/Inet.h +++ b/uppsrc/Core/Inet.h @@ -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, diff --git a/uppsrc/Core/Socket.cpp b/uppsrc/Core/Socket.cpp index ea861de00..acc50386b 100644 --- a/uppsrc/Core/Socket.cpp +++ b/uppsrc/Core/Socket.cpp @@ -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; }