I use the asynchronous access to be able to abort on a timeout.
First I had IMA's with FinishHTTP() because I forgot to abort the request with AbortHTTP() at the timeout.
But now the errors occur with AbortHTTP().
My question is: the following code, is it a good construct in principle or do you see something that is misapplied?
Code: Select all
HttpRequest = HTTPRequest(#PB_HTTP_Get, Url, Param, #PB_HTTP_NoSSLCheck|#PB_HTTP_Asynchronous, Header$())
If HttpRequest
Repeat
Progress = HTTPProgress(HttpRequest)
Select Progress
Case #PB_HTTP_Success
StatusCode = HTTPInfo(HTTPRequest, #PB_HTTP_StatusCode)
Result = HTTPInfo(HTTPRequest, #PB_HTTP_Response)
Break
Case #PB_HTTP_Failed
Debug "Download failed"
Break
Case #PB_HTTP_Aborted
Debug "Download aborted"
Break
Default
If TimeOut < Date()
AbortHTTP(HttpRequest)
Break
EndIf
Delay(50)
EndSelect
ForEver
FinishHTTP(HttpRequest)
Glad to get any help.
Dige