diff options
Diffstat (limited to 'lib/HttpClient.cc')
-rw-r--r-- | lib/HttpClient.cc | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/lib/HttpClient.cc b/lib/HttpClient.cc index cc636ed..6f8a262 100644 --- a/lib/HttpClient.cc +++ b/lib/HttpClient.cc @@ -44,7 +44,7 @@ int HttpClient::Do() throw (GeneralException) { if (!Client.IsConnected()) { return TASK_DONE; } - RemoveTimeout(); WaitFor(timeout); + RemoveTimeout(); b << "GET " + uri + " HTTP/1.1\r\n" "Host: " + host + "\r\n" @@ -57,6 +57,7 @@ int HttpClient::Do() throw (GeneralException) { b << "\r\n"; c = new CopyJob(&b, &Client); + WaitFor(timeout); WaitFor(c); current = 1; Suspend(TASK_ON_HOLD); @@ -68,9 +69,10 @@ int HttpClient::Do() throw (GeneralException) { status = "Connection timeout."; return TASK_DONE; } - RemoveTimeout(); WaitFor(timeout); + RemoveTimeout(); c = new ReadJob(&Client, &b); + WaitFor(timeout); WaitFor(c); current = 2; Suspend(TASK_ON_HOLD); @@ -82,7 +84,7 @@ int HttpClient::Do() throw (GeneralException) { status = "Connection timeout."; return TASK_DONE; } - RemoveTimeout(); WaitFor(timeout); + RemoveTimeout(); b >> t; if (!h_reply.Match(t)) { @@ -113,6 +115,7 @@ int HttpClient::Do() throw (GeneralException) { if (!chunked) { current = 5; c = new CopyJob(&Client, out); + WaitFor(timeout); WaitFor(c); Suspend(TASK_ON_HOLD); } @@ -127,9 +130,10 @@ int HttpClient::Do() throw (GeneralException) { status = "Connection timeout."; return TASK_DONE; } - RemoveTimeout(); WaitFor(timeout); + RemoveTimeout(); c = new ReadJob(&Client, &b, any); + WaitFor(timeout); WaitFor(c); current = 4; Suspend(TASK_ON_HOLD); @@ -141,7 +145,7 @@ int HttpClient::Do() throw (GeneralException) { status = "Connection timeout."; return TASK_DONE; } - RemoveTimeout(); WaitFor(timeout); + RemoveTimeout(); b >> t; @@ -158,6 +162,7 @@ int HttpClient::Do() throw (GeneralException) { } c = new CopyJob(&Client, out, l); + WaitFor(timeout); WaitFor(c); current = 3; Suspend(TASK_ON_HOLD); |