From: Pat Thoyts Date: Thu, 13 Dec 2007 00:10:06 +0000 (+0000) Subject: Added some extra accessors - in particular rawdata for fetching bytes instead of... X-Git-Tag: tclole-0-4~4 X-Git-Url: http://privyetmir.co.uk/gitweb?a=commitdiff_plain;h=28de21b6a296c293fd51819007a2b34b71aca505;p=tclole Added some extra accessors - in particular rawdata for fetching bytes instead of encoding fixed utf8 --- diff --git a/library/http.tcl b/library/http.tcl index d98fd6d..6b89d95 100644 --- a/library/http.tcl +++ b/library/http.tcl @@ -11,7 +11,7 @@ package require tclole namespace eval ::ole::http { - variable version 1.0.0 + variable version 1.1.0 variable watchlist {} variable watchtimer {} @@ -19,7 +19,7 @@ namespace eval ::ole::http { } 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 {}} @@ -93,7 +93,6 @@ proc ::ole::http::Poll {} { lappend state(meta) $h $v } } - set state(body) [$state(xmlhttp) responseText] if {$state(-command) ne ""} { if {[catch {eval $state(-command) $token} err]} { ::bgerror $err @@ -128,7 +127,15 @@ proc ::ole::http::status {token} { } 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