#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.59 for tclole 0.4.
+# Generated by GNU Autoconf 2.59 for tclole 0.5.
#
# Copyright (C) 2003 Free Software Foundation, Inc.
# This configure script is free software; the Free Software Foundation
# Identity of this package.
PACKAGE_NAME='tclole'
PACKAGE_TARNAME='tclole'
-PACKAGE_VERSION='0.4'
-PACKAGE_STRING='tclole 0.4'
+PACKAGE_VERSION='0.5'
+PACKAGE_STRING='tclole 0.5'
PACKAGE_BUGREPORT=''
# Factoring default headers for most tests.
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
-\`configure' configures tclole 0.4 to adapt to many kinds of systems.
+\`configure' configures tclole 0.5 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
if test -n "$ac_init_help"; then
case $ac_init_help in
- short | recursive ) echo "Configuration of tclole 0.4:";;
+ short | recursive ) echo "Configuration of tclole 0.5:";;
esac
cat <<\_ACEOF
test -n "$ac_init_help" && exit 0
if $ac_init_version; then
cat <<\_ACEOF
-tclole configure 0.4
+tclole configure 0.5
generated by GNU Autoconf 2.59
Copyright (C) 2003 Free Software Foundation, Inc.
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
-It was created by tclole $as_me 0.4, which was
+It was created by tclole $as_me 0.5, which was
generated by GNU Autoconf 2.59. Invocation command line was
$ $0 $@
} >&5
cat >&5 <<_CSEOF
-This file was extended by tclole $as_me 0.4, which was
+This file was extended by tclole $as_me 0.5, which was
generated by GNU Autoconf 2.59. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
cat >>$CONFIG_STATUS <<_ACEOF
ac_cs_version="\\
-tclole config.status 0.4
+tclole config.status 0.5
configured by $0, generated by GNU Autoconf 2.59,
with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\"
variable uid ; if {![info exists uid]} { set uid 0 }
set token [namespace current]::http[incr uid]
upvar #0 $token state
- array set state {method GET -query "" -command {} -timeout {} -progress {} -headers {}}
+ array set state {method GET afterid {} state {} xmlhttp {}
+ -query "" -command {} -timeout {} -progress {} -headers {}}
set state(url) $url
while {[string match -* [set option [lindex $args 0]]]} {
}
if {$state(-query) ne ""} { set state(method) POST }
- set state(xmlhttp) ""
- foreach progid {MSXML2.XMLHTTP.6.0 MSXML2.XMLHTTP.5.0 MSXML2.XMLHTTP.4.0 \
- MSXML2.XMLHTTP.3.0 MSXML2.XMLHTTP.2.6 Microsoft.XMLHTTP} {
- if {![catch {set state(xmlhttp) [ole::ref createobject MSXML2.XMLHTTP]}]} {
+ foreach progid {MSXML2.XMLHTTP.6.0 MSXML2.XMLHTTP.5.0 \
+ MSXML2.XMLHTTP.4.0 MSXML2.XMLHTTP.3.0 \
+ MSXML2.XMLHTTP.2.6 Microsoft.XMLHTTP} {
+ set r [catch {ole::ref createobject $progid} err]
+ if {!$r} {
+ set state(xmlhttp) $err
break
}
}
- if {$state(xmlhttp) eq {}} { return -code error "error: no suitable XMLHttp object available" }
+ if {$state(xmlhttp) eq {}} {
+ return -code error "error: no suitable XMLHttp object available"
+ }
$state(xmlhttp) open $state(method) $url True
- $state(xmlhttp) -put onreadystatechange [ole::ref self [list [namespace origin Callback] $token]]
+ $state(xmlhttp) -put onreadystatechange \
+ [ole::ref self [list [namespace origin Callback] $token]]
foreach {hdr val} $state(-headers) {
$state(xmlhttp) setRequestHeader $hdr $val
}
+ set state(state) waiting
+ if {$state(-timeout) ne ""} {
+ set state(afterid) [after $state(-timeout) \
+ [list [namespace origin Timeout] $token]]
+ }
$state(xmlhttp) send $state(-query)
- if {$state(-command) eq {}} {
- wait $token
- } else {
- watch $token
+ # this isn't stupid: if the request is already in the IE cache it will
+ # complete before we hit the next line and if a command was set and
+ # cleans up the array we will never see it here.
+ if {[info exists state]} {
+ if {$state(-command) eq {}} {
+ if {$state(state) eq "waiting"} {
+ ::vwait [::set token](state)
+ }
+ }
}
return $token
}
-proc ::ole::http::Callback {token dispid args} {
- # replace the polling stuff with a check of ...
+proc ::ole::http::Timeout {token} {
upvar #0 $token state
- if {[$state(xmlhttp) readyState] == 4} {
- # do stuff
- }
+ after cancel $state(afterid)
+ $state(xmlhttp) abort
+ Finish $token timeout
}
-proc ::ole::http::wait {token} {
+proc ::ole::http::Callback {token dispid args} {
+ # replace the polling stuff with a check of ...
upvar #0 $token state
- watch $token
- if {$state(state) eq "waiting"} {
- ::vwait [::set token](state)
+ if {[$state(xmlhttp) readyState] == 4} {
+ Finish $token ok
}
}
-proc ::ole::http::watch {token} {
- variable watchlist
- variable watchtimer
+proc ::ole::http::Finish {token reason} {
upvar #0 $token state
- set state(begin) [clock seconds]
- set state(state) waiting
- after cancel $watchtimer
- lappend watchlist $token
- Poll
-}
-
-proc ::ole::http::Poll {} {
- variable watchlist
- variable watchtimer
- if {[llength $watchlist] > 0} {
- set newlist {}
- foreach token $watchlist {
- upvar #0 $token state
- if {$state(state) eq "waiting"} {
- if {[$state(xmlhttp) readyState] == 4} {
- set state(state) ok
- set state(ncode) [$state(xmlhttp) status]
- set state(code) [$state(xmlhttp) statusText]
- set state(meta) {}
- foreach line [split [$state(xmlhttp) getAllResponseHeaders] "\n"] {
- if {[regexp {^([^:]+): ?(.*)} $line -> h v]} {
- lappend state(meta) $h [string trimright $v]
- }
- }
- if {$state(-command) ne ""} {
- if {[catch {eval $state(-command) $token} err]} {
- ::bgerror $err
- }
- }
- break
- }
- if {$state(-timeout) ne ""
- && ([clock seconds] - $state(begin)) > $state(-timeout)} {
- set state(state) timeout
- $state(xmlhttp) abort
- if {$state(-command) ne ""} {
- if {[catch {eval $state(-command) $token} err]} {
- ::bgerror $err
- }
- }
- break
- }
- lappend newlist $token
- }
+ after cancel $state(afterid)
+ set state(ncode) [$state(xmlhttp) status]
+ set state(code) [$state(xmlhttp) statusText]
+ set state(meta) {}
+ foreach line [split [$state(xmlhttp) getAllResponseHeaders] "\n"] {
+ if {[regexp {^([^:]+): ?(.*)} $line -> h v]} {
+ lappend state(meta) $h [string trimright $v]
}
- set watchlist $newlist
- if {[llength $watchlist] > 0} {
- set watchtimer [after 200 [namespace origin Poll]]
+ }
+ set state(state) $reason
+ if {$state(-command) ne {}} {
+ if {[catch {eval $state(-command) $token} err]} {
+ ::bgerror $err
}
}
}