[Gambas-user] HTTPClient freeze after 40 mins with Gambas 3.18.4

T Lee Davidson t.lee.davidson at gmail.com
Thu Sep 28 23:05:42 CEST 2023


On 9/28/23 16:56, Christof Thalhofer wrote:
> Am 28.09.23 um 22:06 schrieb Benoît Minisini:
> 
>> How do you use exactly your HttpClient object? Which properties do you
>> set with which values? Which methods do you call with which arguments?
> 
> This is the Get() function which does the job:
> 
>> Private $H As New HttpClient As "HClient"
>> > Public Function Get() As String
>>
>>     Dim sBuffer As String
>>
>  >     ' $H.URL is filled at another place
>>     If $H.URL Then
>>
>>         $H.Async = False
>>         $H.Timeout = 600
>>
>>         $H.Get
>>
>>         ' Success - read the data
>>         If Lof($H) Then sBuffer = Read #$H, Lof($H)
>>
>>         If $H.Code > 299 Then
>>             Error.Raise("Degapp Fehler – Code " & $H.Code & " " & sBuffer)
>>         Endif
>>
>>         If $H.Status < 0 Then
>>             Error.Raise("Connection zu Degapp kaputt. Curl Status (" & $H.Status & ") kleiner 0.")
>>         Else
>>             $H.Close
>>             Return sBuffer
>>         End If
>>     Else
>>         Error.Raise("Der Pfad für Degapp ist nicht definiert.")
>>     Endif
>>
>> End
> 
> It's inspired from code in
> 
> http://gambaswiki.org/wiki/comp/gb.net.curl/httpclient
> 
> Alles Gute
> 
> Christof Thalhofer

I doubt it's causing the issue, but shouldn't .Status be checked for Curl error values prior to reading the stream into the buffer?


-- 
Lee



More information about the User mailing list