summaryrefslogtreecommitdiffstats
path: root/library/http/http.tcl
diff options
context:
space:
mode:
Diffstat (limited to 'library/http/http.tcl')
-rw-r--r--library/http/http.tcl17
1 files changed, 9 insertions, 8 deletions
diff --git a/library/http/http.tcl b/library/http/http.tcl
index 7ae2286..3e6f8ec 100644
--- a/library/http/http.tcl
+++ b/library/http/http.tcl
@@ -9,7 +9,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.tcl,v 1.43 2002/10/03 13:34:32 dkf Exp $
+# RCS: @(#) $Id: http.tcl,v 1.44 2003/03/19 21:57:47 dgp Exp $
# Rough version history:
# 1.0 Old http_get interface
@@ -25,7 +25,7 @@
package require Tcl 8.2
# keep this in sync with pkgIndex.tcl
# and with the install directories in Makefiles
-package provide http 2.4.2
+package provide http 2.4.3
namespace eval http {
variable http
@@ -119,7 +119,7 @@ proc http::config {args} {
}
return $result
}
- regsub -all -- - $options {} options
+ set options [string map {- ""} $options]
set pat ^-([join $options |])$
if {[llength $args] == 1} {
set flag [lindex $args 0]
@@ -260,7 +260,7 @@ proc http::geturl { url args } {
-progress -query -queryblocksize -querychannel -queryprogress\
-validate -timeout -type}
set usage [join $options ", "]
- regsub -all -- - $options {} options
+ set options [string map {- ""} $options]
set pat ^-([join $options |])$
foreach {flag value} $args {
if {[regexp $pat $flag]} {
@@ -414,7 +414,7 @@ proc http::geturl { url args } {
}
puts $s "User-Agent: $http(-useragent)"
foreach {key value} $state(-headers) {
- regsub -all \[\n\r\] $value {} value
+ set value [string map [list \n "" \r ""] $value]
set key [string trim $key]
if {[string equal $key "Content-Length"]} {
set contDone 1
@@ -678,8 +678,9 @@ proc http::Event {token} {
} elseif {$n == 0} {
variable encodings
set state(state) body
- if {$state(-binary) || ![regexp -nocase ^text $state(type)] || \
- [regexp gzip|compress $state(coding)]} {
+ if {$state(-binary) || ![string match -nocase text* $state(type)]
+ || [string match *gzip* $state(coding)]
+ || [string match *compress* $state(coding)]} {
# Turn off conversions for non-text data
fconfigure $s -translation binary
if {[info exists state(-channel)]} {
@@ -716,7 +717,7 @@ proc http::Event {token} {
}
if {[regexp -nocase {^([^:]+):(.+)$} $line x key value]} {
lappend state(meta) $key [string trim $value]
- } elseif {[regexp ^HTTP $line]} {
+ } elseif {[string match HTTP* $line]} {
set state(http) $line
}
}