|
Tcl HTTP KeepAlive and 1.1 Support |
![]() |
||||||||||||||
|
I have done some work on the Tcl core http2.4 package to implement Keep Alive support and to begin supporting the HTTP/1.1 protocol. Currently Tcl's http client package only supports HTTP/1.0. The keepalive support is especially useful for https connections using the tls package. As there has been some general interest in this code - a long thread on c.l.t (a mail log of this thread is here) precipitated my work on this - I have put my working files into the tclsoap CVS respository. You can access this using the following cvs -z6 -d:pserver:anonymous@cvs.tclsoap.sourceforge.net:/cvsroot/tclsoap login cvs -z6 -d:pserver:anonymous@cvs.tclsoap.sourceforge.net:/cvsroot/tclsoap co http You should just hit enter at the login password. Alternatively you can use your web browser and navigate to http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/tclsoap/http/ This is work in progress. As soon as it has been tested a bit and seems reasonably RFC compliant it'll be submitted to the Tcl core. In the meantime I have incremented the package number to 2.5 so you can guaruntee to use the official package by doing package require -exact 2.4 Here's a simple example where we connect to a site and keep the connection open while we grab the root and subsidiary files that make up the page. On the last request we indicate that we'll close the connection once this request has completed. set tok(1) [http::geturl http://tclsoap.sf.net/ -keepalive 1 -socketvar ::s] set tok(2) [http::geturl http://tclsoap.sf.net/tclsoap.gif -keepalive 1 -socketvar ::s] set tok(3) [http::geturl http://tclsoap.sf.net/tclsoap.css -keepalive 0 -socketvar ::s] If the remote host times out or closes their end for some reason then the socketvar variable is unset. This means that the next request will be forced to open a new connection whatever you may have specified to keepalive. | |||||||||||||||
$Id$ |