Multiple http requests are not supported, unfortunately.
I push subsequent requests on to a stack, and process them when the
first request is finished.
The http callbacks will not fix that, though they could make the stack
processing easier.
I guess another way to handle that would be to create a Tcl thread for
each http request. But I've never tried that.
http://www.tcl-lang.org/man/tcl8.6/TclCmd/http.htm#M21
Use the -command option of the http command.
I have in my http utilities script:
set htoken [::http::geturl $turl \
-keepalive true \
-command [list after idle \
[list ::httputils::_httpProcess $url $query $retryCount \
$callback $args]] \
{*}$getargs]
The [list after idle ...] works around the http's package error processing
so that you can actually process the errors.
$getargs is usually [list -get].
$retryCount is used by my _httpProcess() routine.
$callback is my script to process the returned data once _httpProcess()
has done all of the checks on the return code/etc.
proc _httpProcess { url query retryCount callback arglist htoken } {
set meta [::http::meta $htoken]
set ncode [::http::ncode $htoken]
...
{*}$callback [list $ncode $data]
}