diff options
author | pixel <pixel> | 2007-05-24 13:52:23 +0000 |
---|---|---|
committer | pixel <pixel> | 2007-05-24 13:52:23 +0000 |
commit | ca5717feeec139896ff37374d24e714f876819a4 (patch) | |
tree | 77cbdab97750c58d7378111a61e39ef32c09adb1 | |
parent | 101cc1939db21d7b2f55445a187421e4acedb383 (diff) |
Fixed timeout handling code.
-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); |