diff --git a/uppsrc/Core/Http.cpp b/uppsrc/Core/Http.cpp index 5e545318a..35040bbbf 100644 --- a/uppsrc/Core/Http.cpp +++ b/uppsrc/Core/Http.cpp @@ -473,11 +473,13 @@ void HttpRequest::Start() void HttpRequest::Dns() { - for(int i = 0; i <= Nvl(GetTimeout(), INT_MAX); i++) + for(int i = 0; i <= Nvl(GetTimeout(), INT_MAX); i++) { if(!addrinfo.InProgress()) { StartRequest(); return; } + Sleep(1); + } } void HttpRequest::StartRequest() @@ -569,4 +571,21 @@ String HttpRequest::Execute() return IsSuccess() ? GetContent() : String::GetVoid(); } +String HttpRequest::GetPhaseName() const +{ + static const char *m[] = { + "Start", + "Resolving host name", + "Sending request", + "Receiving header", + "Receiving content", + "Receiving chunk header", + "Receiving content chunk", + "Receiving trailer", + "Finished", + "Failed", + }; + return phase >= 0 && phase <= FAILED ? m[phase] : ""; +} + END_UPP_NAMESPACE diff --git a/uppsrc/Core/Web.h b/uppsrc/Core/Web.h index 11dc2747a..ee49a81cf 100644 --- a/uppsrc/Core/Web.h +++ b/uppsrc/Core/Web.h @@ -327,6 +327,7 @@ public: bool Do(); int GetPhase() const { return phase; } + String GetPhaseName() const; bool InProgress() const { return phase != FAILED && phase != FINISHED; } bool IsFailure() const { return phase == FAILED; } bool IsSuccess() const { return phase == FINISHED && status_code >= 200 && status_code < 300; }