diff options
Diffstat (limited to 'doc/http.n')
-rw-r--r-- | doc/http.n | 52 |
1 files changed, 26 insertions, 26 deletions
@@ -6,7 +6,7 @@ '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -'\" RCS: @(#) $Id: http.n,v 1.38 2008/10/17 10:22:25 dkf Exp $ +'\" RCS: @(#) $Id: http.n,v 1.39 2010/01/20 13:42:17 dkf Exp $ '\" .so man.macros .TH "http" n 2.7 http "Tcl Bundled Packages" @@ -606,36 +606,36 @@ progress meter, and prints the meta-data associated with the URL. .PP .CS proc httpcopy { url file {chunk 4096} } { - set out [open $file w] - set token [\fB::http::geturl\fR $url -channel $out \e - -progress httpCopyProgress -blocksize $chunk] - close $out + set out [open $file w] + set token [\fB::http::geturl\fR $url -channel $out \e + -progress httpCopyProgress -blocksize $chunk] + close $out - # This ends the line started by httpCopyProgress - puts stderr "" + # This ends the line started by httpCopyProgress + puts stderr "" - upvar #0 $token state - set max 0 - foreach {name value} $state(meta) { - if {[string length $name] > $max} { - set max [string length $name] - } - if {[regexp -nocase ^location$ $name]} { - # Handle URL redirects - puts stderr "Location:$value" - return [httpcopy [string trim $value] $file $chunk] - } - } - incr max - foreach {name value} $state(meta) { - puts [format "%-*s %s" $max $name: $value] - } + upvar #0 $token state + set max 0 + foreach {name value} $state(meta) { + if {[string length $name] > $max} { + set max [string length $name] + } + if {[regexp -nocase ^location$ $name]} { + # Handle URL redirects + puts stderr "Location:$value" + return [httpcopy [string trim $value] $file $chunk] + } + } + incr max + foreach {name value} $state(meta) { + puts [format "%-*s %s" $max $name: $value] + } - return $token + return $token } proc httpCopyProgress {args} { - puts -nonewline stderr . - flush stderr + puts -nonewline stderr . + flush stderr } .CE .SH "SEE ALSO" |