summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--doc/http.n7
-rw-r--r--library/http/http.tcl14
-rw-r--r--tests/http.test7
3 files changed, 7 insertions, 21 deletions
diff --git a/doc/http.n b/doc/http.n
index 2b2d09d..84c75b0 100644
--- a/doc/http.n
+++ b/doc/http.n
@@ -161,12 +161,7 @@ default is 0.
.
The \fIencoding\fR used for creating the x-url-encoded URLs with
\fB::http::formatQuery\fR and \fB::http::quoteString\fR.
-The default is \fButf-8\fR, as specified by RFC
-2718. Prior to http 2.5 this was unspecified, and that behavior can be
-returned by specifying the empty string (\fB{}\fR), although
-\fIiso8859-1\fR is recommended to restore similar behavior but without the
-\fB::http::formatQuery\fR or \fB::http::quoteString\fR
-throwing an error processing non-latin-1 characters.
+The default is \fButf-8\fR, as specified by RFC 2718.
.TP
\fB\-useragent\fR \fIstring\fR
.
diff --git a/library/http/http.tcl b/library/http/http.tcl
index 187d203..87003e4 100644
--- a/library/http/http.tcl
+++ b/library/http/http.tcl
@@ -3539,18 +3539,8 @@ proc http::mapReply {string} {
# a pre-computed map and [string map] to do the conversion (much faster
# than [regsub]/[subst]). [Bug 1020491]
- if {$http(-urlencoding) ne ""} {
- set string [encoding convertto $http(-urlencoding) $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 compatibility... :^/
- return -code error \
- "can't read \"formMap($badChar)\": no such element in array"
- }
- return $converted
+ set string [encoding convertto $http(-urlencoding) $string]
+ return [string map $formMap $string]
}
interp alias {} http::quoteString {} http::mapReply
diff --git a/tests/http.test b/tests/http.test
index d59d588..e3baf58 100644
--- a/tests/http.test
+++ b/tests/http.test
@@ -677,17 +677,18 @@ test http-7.2 {http::mapReply} {
test http-7.3 {http::formatQuery} -setup {
set enc [http::config -urlencoding]
} -returnCodes error -body {
- # this would be reverting to http <=2.4 behavior
+ # -urlencoding "" no longer supported. Use "iso8859-1".
http::config -urlencoding ""
http::mapReply "∈"
} -cleanup {
http::config -urlencoding $enc
-} -result "can't read \"formMap(∈)\": no such element in array"
+} -result {unknown encoding ""}
test http-7.4 {http::formatQuery} -constraints deprecated -setup {
set enc [http::config -urlencoding]
} -body {
# this would be reverting to http <=2.4 behavior w/o errors
- # (unknown chars become '?')
+ # with Tcl 8.x (unknown chars become '?'), generating a
+ # proper exception with Tcl 9.0
http::config -urlencoding "iso8859-1"
http::mapReply "∈"
} -cleanup {