[Gambas-devel] gb.net.curl questions

Ron ron at ...572...
Mon Dec 7 14:33:57 CET 2009


Ron wrote:
>
> 2 things struck me when trying to use gb.net.curl a bit more advanced 
> than usual...
>
> I'm missing methods/request types DELETE and PUT, libcurl supports 
> them... easy to implement?
>
> I need to provide a custom Header, so I do:
>
>  hPost.URL = "MyURL"
>  hPost.TimeOut = 10
>  hPost.Async = TRUE
>  hPost.Headers = ["X-MyHeader: " & sMyHeaderContent]
>  hPost.Post("text/xml", sContent)
>
> But it doesn't seem to work, the header is not recognized, am I doing 
> something wrong?
>
> Gambas 2.18.0
> gb.qt
>
> Thanks and Regards,
> Ron_2nd.
An another thing, if I create 2 HTTPClients with the same name right 
after each other and use them Async only the last one triggers it's 
_Finisched event.
The first one is never triggered.

Is this normal?
So you cannot use 2 with same name right after each other?

I believe Benoit told something like that a long time ago... but can't 
find the e-mail anymore.

PUBLIC hPing AS HTTPClient

PUBLIC SUB Main()

  Ping(26, "192.168.1.61")
  Ping(27, "www.google.com")

END

PRIVATE FUNCTION Ping(iId AS Integer, sAddress AS String) AS Boolean

 hPing = NEW HttpClient AS "hPing"
 hPing.URL = "http://" & sAddress
 hPing.Async = TRUE
 hPing.Tag = iId ' mark with device ID
 hPing.TimeOut = 5
 hPing.Get

CATCH ' some errors
  '
  RETURN FALSE

END

PUBLIC SUB hPing_Finished()

 PRINT LAST.Tag

END

Only prints 27 (the iId of the last HTTPClient instance)

Gambas 2.18.0
gb.qt

Regards,
Ron_2nd.





More information about the Devel mailing list