Version 17 of TclCurl

Updated 2002-04-14 18:36:41

What: TclCurl

 Where:  http://personal1.iddeo.es/andresgarci/tclcurl/english/ >
         http://curl.haxx.se/ >
 Description: Tcl binding for libcurl, a library for accessing internet
        resources of various types.  Supports ftp, telnet,
        ldap, gopher, dict, http, https protocols.
        libcurl is currently at version 7.9.5 and
        TclCurl is currently at version 0.9.5 .
 Updated: 04/2002
 Contact: mailto:[email protected]> (Andres Garcia)

More background is available in "curl Simplifies Web Retrieval" [L1 ].

http://personal1.iddeo.es/andresgarci/tclcurl/english/


So, how is TclCurl better than the bare http package? A few examples should help make that clear [ WWW::Search::* analogue; HotMail mass downloader]. But, wouldn't either of those examples be just as feasible to implement with the http package?

You cannot GET a https page if you are sitting behind a proxy using the bare http package. I haven't tried TclCurl yet. US


  • websearch, an initial WWW::Search like package (using the http package, though, not TclCurl)

Most of the time you are right, the http package is complete enough to satisfy most users, TclCurl does provide more features, but unless you need them, you'd better use the http package and forget about the lack of portability a C extension brings.

But as I said, TclCurl does have more features, for example you can tunnel non-http request through a http proxy, I haven't tried it myself, but it should be something like:

curl::transfer -url https://www.securedomain.com -file index.html \

        -httpproxytunnel 1 -proxy 192.168.0.1:80

I don't have a proxy to test this, could someone please check whether it works?

TclCurl supports http 1.1, including keep-alive and resumed transfers, though there is work by Pat Thoyts to add 1.1 support for the http package, which you can get at http://tclsoap.sourceforge.net/http.html

As for the rest of the TclCurl features, some would be trivial to implement in Tcl, like being able to follow redirections, some a little bit harder, like cookie support, but the principle is always the same, check the features you need and if the http package offers them, use it, if it doesn't check TclCurl.

There is one thing though that may prevent you for using TclCurl, at least for now, it blocks while doing a transfer, that means that the GUI of a Tcl/Tk program will freeze, you can define a procedure to be invoked during the transfer, about once every second, and force and update from there, but the result is not very responsive.

In that case, if you do need the extra features, you may need to exec cURL directly through a non-blocking pipe.

Appart from http(s), TclCurl also offers support for other protocols, like ldap, gopher, ftp, ... but I have never used the pure Tcl clients, so I have no idea how they compare.

Even though they have not been written with TclCurl in mind, you may want to read:

http://curl.haxx.se/docs/httpscripting.shtml

and

http://curl.haxx.se/libcurl/c/the-guide.html

They will give you an idea of what can be done using TclCurl.

Andres

Category Package