[Gambas-user] HttpClient - Out of memory errors

paulwheeler paulwheeler at ...546...
Mon May 19 03:05:00 CEST 2014


I am attempting to use the HttpClient, but keep getting these messages:
hClient.Status = -1027
hClient.ErrorText = Out of memory


I took the example program that comes with Gambas (HttpGet 3.0.0) and modified it to bypass the form, to make it easier to make and test changes.

Some HTTP addresses work, but others do not. Some that work are: "http://elinks.or.cz/" and  "http://gambasdoc.org/help"

One that I need to run, but doesn't is: hClient.URL = "https://sandbox.familysearch.org/.well-known/app-meta"

Note that I can take the "https://sandbox.familysearch.org/.well-known/app-meta" address and paste it into my browser and I have exactly what I am looking for.



Just so you know, this is an example of a  'Get' that I am trying to write in Gambas:

GET https://sandbox.familysearch.org/.well-known/app-meta
Accept: application/atom+xml



This is my current code:

Public Sub Form_Open()

   '///////////////////////////////////
   ' We set Default configuration values
   '///////////////////////////////////
   ClsParams.ProxyHost = "127.0.0.1:3128"
   ClsParams.ProxyUser = ""
   ClsParams.ProxyPwd = ""

   ClsParams.ProxyAuth = Net.AuthNone
   ClsParams.CookiesFile = User.Home & "/gbcookies.txt"
   '////////////////////////////////////
   ' Now we create the HttpClient object
   '////////////////////////////////////
   'MyHTTP=NEW HttpClient AS "MyHTTP"


     GetFile()

End


Public Sub GetFile()

   Dim hClient As HttpClient
   Dim sBuffer As String

   hClient = New HttpClient As "hClient"

'  hClient.URL = "http://gambasdoc.org/help"
   hClient.URL = "https://sandbox.familysearch.org/.well-known/app-meta"
   hClient.Async = False
   hClient.Timeout = 20    ''' was 60

'  hClient.Encoding = "Accept: application/atom+xml"
   hClient.Encoding = "Accept: application/xml"
'  hClient.Encoding = "Accept: text/html"
   hClient.Get()

   Print "Begin"
   If hClient.Status < 0 Then
     Print "hClient.Status = " & hClient.Status
     Print "hClient.ErrorText = " & hClient.ErrorText

   Else
     ' Success - read the data
     If Lof(hClient) Then sBuffer = Read #hClient, Lof(hClient)
     Print sBuffer
     Print "hClient.code (good)= " & hClient.Code
     Print "hClient.reason = " & hClient.reason
   End If


   Print "end"

End


Results:
with   hClient.URL = "http://gambasdoc.org/help"
hClient.code (good)= 200
hClient.reason =  OK


with   hClient.URL = "https://sandbox.familysearch.org/.well-known/app-meta"
hClient.Status = -1027
hClient.ErrorText = Out of memory




[System]
OperatingSystem=Linux
Kernel=3.11.0-12-generic
Architecture=x86_64
Memory=8048256 kB
DistributionVendor=LinuxMint
DistributionRelease="Linux Mint 16 Petra"
Desktop=Gnome

[Gambas 3]
Version=3.1.1
Path=/usr/bin/gbx3

[Libraries]
Qt4=libQtCore.so.4.8.4
GTK+=libgtk-x11-2.0.so.0.2400.20






More information about the User mailing list