mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-07-11 22:03:01 -06:00
Core: Http
git-svn-id: svn://ultimatepp.org/upp/trunk@4754 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
parent
db0e8ff979
commit
2959013cda
2 changed files with 21 additions and 1 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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; }
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue