summaryrefslogtreecommitdiffstats
path: root/library/http
diff options
context:
space:
mode:
authordgp <dgp@users.sourceforge.net>2003-03-19 21:57:29 (GMT)
committerdgp <dgp@users.sourceforge.net>2003-03-19 21:57:29 (GMT)
commitbb7105fe9e61473e34a6dfa06700dbc252afeb19 (patch)
tree442e8a70c6a7eb9cab94e31ce02f4e195e3956b3 /library/http
parent2f7a25d9e6cc43c401cbb12b0a35adca9ba526ca (diff)
downloadtcl-bb7105fe9e61473e34a6dfa06700dbc252afeb19.zip
tcl-bb7105fe9e61473e34a6dfa06700dbc252afeb19.tar.gz
tcl-bb7105fe9e61473e34a6dfa06700dbc252afeb19.tar.bz2
* library/auto.tcl: Replaced [regexp] and [regsub] with
* library/history.tcl: [string map] where possible. Thanks * library/ldAout.tcl: to David Welton. [Bugs 667456,667558] * library/safe.tcl: Bumped to http 2.4.3, opt 0.4.5, and * library/http/http.tcl: tcltest 2.2.3. * library/http/pkgIndex.tcl: * library/opt/optparse.tcl: * library/opt/pkgIndex.tcl: * library/tcltest/tcltest.tcl: * library/tcltest/pkgIndex.tcl: * tools/genStubs.tcl: * tools/tcltk-man2html.tcl: * unix/mkLinks.tcl:
Diffstat (limited to 'library/http')
-rw-r--r--library/http/http.tcl17
-rw-r--r--library/http/pkgIndex.tcl2
2 files changed, 10 insertions, 9 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
}
}
diff --git a/library/http/pkgIndex.tcl b/library/http/pkgIndex.tcl
index 8461a67..3adc591 100644
--- a/library/http/pkgIndex.tcl
+++ b/library/http/pkgIndex.tcl
@@ -9,4 +9,4 @@
# full path name of this file's directory.
if {![package vsatisfies [package provide Tcl] 8.2]} {return}
-package ifneeded http 2.4.2 [list tclPkgSetup $dir http 2.4.2 {{http.tcl source {::http::config ::http::formatQuery ::http::geturl ::http::reset ::http::wait ::http::register ::http::unregister}}}]
+package ifneeded http 2.4.3 [list tclPkgSetup $dir http 2.4.3 {{http.tcl source {::http::config ::http::formatQuery ::http::geturl ::http::reset ::http::wait ::http::register ::http::unregister}}}]