package require tclole
namespace eval ::ole::http {
- variable version 1.0.0
+ variable version 1.1.0
variable watchlist {}
variable watchtimer {}
}
proc ::ole::http::geturl {url args} {
- variable uid
+ 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 {}}
lappend state(meta) $h $v
}
}
- set state(body) [$state(xmlhttp) responseText]
if {$state(-command) ne ""} {
if {[catch {eval $state(-command) $token} err]} {
::bgerror $err
}
proc ::ole::http::data {token} {
upvar #0 $token state
- return $state(body)
+ return [$state(xmlhttp) responseText]
+}
+proc ::ole::http::rawdata {token} {
+ upvar #0 $token state
+ return [$state(xmlhttp) responseBody]
+}
+proc ::ole::http::xml {token} {
+ upvar #0 $token state
+ return [$state(xmlhttp) responseXml]
}
proc ::ole::http::ncode {token} {
upvar #0 $token state