summaryrefslogtreecommitdiffstats
path: root/library/http
diff options
context:
space:
mode:
authordkf <donal.k.fellows@manchester.ac.uk>2005-01-06 15:15:42 (GMT)
committerdkf <donal.k.fellows@manchester.ac.uk>2005-01-06 15:15:42 (GMT)
commit1710976abe1deba276cdd00851965d411927f959 (patch)
tree4423941234f43a2d8275b3d2630e17d3a365d342 /library/http
parent6486719f0c7028711902d98c299289de759010d7 (diff)
downloadtcl-1710976abe1deba276cdd00851965d411927f959.zip
tcl-1710976abe1deba276cdd00851965d411927f959.tar.gz
tcl-1710976abe1deba276cdd00851965d411927f959.tar.bz2
Horrible hack to keep the old error message.
Diffstat (limited to 'library/http')
-rw-r--r--library/http/http.tcl14
1 files changed, 11 insertions, 3 deletions
diff --git a/library/http/http.tcl b/library/http/http.tcl
index 9baeef4..d6484cc 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.49 2005/01/06 11:15:21 dkf Exp $
+# RCS: @(#) $Id: http.tcl,v 1.50 2005/01/06 15:15:42 dkf Exp $
# Rough version history:
# 1.0 Old http_get interface
@@ -41,7 +41,7 @@ namespace eval http {
proc init {} {
# Set up the map for quoting chars
# The spec says: "non-alphanumeric characters are replaced by '%HH'"
- for {set i 0} {$i <= 256} {incr i} {
+ for {set i 0} {$i < 256} {incr i} {
set c [format %c $i]
if {![string match {[a-zA-Z0-9]} $c]} {
set map($c) %[format %.2x $i]
@@ -896,8 +896,16 @@ proc http::mapReply {string} {
if {$http(-urlencoding) ne ""} {
set string [encoding convertto $http(-urlencoding) $string]
+ return [string map $formMap $string]
}
- return [string map $formMap $string]
+ set converted [string map $formMap $string]
+ if {[string match "*\[\u0100-\uffff\]*" $converted]} {
+ regexp {[\u0100-\uffff]} $converted badChar
+ # Return this error message for maximum compatability... :^/
+ return -code error \
+ "can't read \"formMap($badChar)\": no such element in array"
+ }
+ return $converted
}
# http::ProxyRequired --