summaryrefslogtreecommitdiffstats
path: root/library/http/http.tcl
diff options
context:
space:
mode:
authorhobbs <hobbs>2005-10-05 05:01:37 (GMT)
committerhobbs <hobbs>2005-10-05 05:01:37 (GMT)
commit9f6bbd3b79f74a8449023467afca0207c7621dad (patch)
tree29c75199c236489f27110732b2078142188520c8 /library/http/http.tcl
parentac08c2624bd5c89d68f61d6899b692051cf75fb1 (diff)
downloadtcl-9f6bbd3b79f74a8449023467afca0207c7621dad.zip
tcl-9f6bbd3b79f74a8449023467afca0207c7621dad.tar.gz
tcl-9f6bbd3b79f74a8449023467afca0207c7621dad.tar.bz2
* tests/http.test: do not URI encode -._~ according
* library/http/http.tcl (init): to RFC3986. [Bug 1182373] (aho)
Diffstat (limited to 'library/http/http.tcl')
-rw-r--r--library/http/http.tcl10
1 files changed, 7 insertions, 3 deletions
diff --git a/library/http/http.tcl b/library/http/http.tcl
index 4c87fab..8b846e5 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.2.6 2005/01/06 15:16:03 dkf Exp $
+# RCS: @(#) $Id: http.tcl,v 1.43.2.7 2005/10/05 05:01:37 hobbs Exp $
# Rough version history:
# 1.0 Old http_get interface
@@ -40,10 +40,14 @@ namespace eval http {
proc init {} {
# Set up the map for quoting chars
- # The spec says: "non-alphanumeric characters are replaced by '%HH'"
+ # RFC3986 Section 2.3 say percent encode all except:
+ # "... percent-encoded octets in the ranges of ALPHA
+ # (%41-%5A and %61-%7A), DIGIT (%30-%39), hyphen (%2D),
+ # period (%2E), underscore (%5F), or tilde (%7E) should
+ # not be created by URI producers ..."
for {set i 0} {$i <= 256} {incr i} {
set c [format %c $i]
- if {![string match {[a-zA-Z0-9]} $c]} {
+ if {![string match {[-._~a-zA-Z0-9]} $c]} {
set map($c) %[format %.2x $i]
}
}