home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Practical Programming in Tcl & Tk (4th Edition)
/
TCLBOOK4.BIN
/
pc
/
exsource.old
/
17_10.tcl
< prev
next >
Wrap
Text File
|
2003-04-15
|
377b
|
22 lines
#
# Example 17-10
# HttpGetText reads text URLs.
#
proc HttpGetText {url} {
upvar #0 $url state
if {[eof $state(sock)]} {
# Content complete
set state(status) done
close $state(sock)
} elseif {[catch {read $state(sock)} block]} {
set state(status) error
lappend state(headers) [list error $block]
close $state(sock)
} else {
append state(body) $block
}
}