From 9f6bbd3b79f74a8449023467afca0207c7621dad Mon Sep 17 00:00:00 2001 From: hobbs Date: Wed, 5 Oct 2005 05:01:37 +0000 Subject: * tests/http.test: do not URI encode -._~ according * library/http/http.tcl (init): to RFC3986. [Bug 1182373] (aho) --- ChangeLog | 3 +++ library/http/http.tcl | 10 +++++++--- tests/http.test | 6 +++--- 3 files changed, 13 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index 817996d..b04f1ce 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ 2005-10-04 Jeff Hobbs + * tests/http.test: do not URI encode -._~ according + * library/http/http.tcl (init): to RFC3986. [Bug 1182373] (aho) + * generic/tclIOUtil.c (TclFSNormalizeAbsolutePath): make static * generic/tclEncoding.c (TclFindEncodings): make static 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] } } diff --git a/tests/http.test b/tests/http.test index 942c9a5..b0020e7 100644 --- a/tests/http.test +++ b/tests/http.test @@ -12,7 +12,7 @@ # of this file, and for a DISCLAIMER OF ALL WARRANTIES. # # -# RCS: @(#) $Id: http.test,v 1.33.2.2 2004/05/25 22:50:47 hobbs Exp $ +# RCS: @(#) $Id: http.test,v 1.33.2.3 2005/10/05 05:01:37 hobbs Exp $ if {[lsearch [namespace children] ::tcltest] == -1} { package require tcltest 2 @@ -483,7 +483,7 @@ test http-5.3 {http::formatQuery} { test http-5.4 {http::formatQuery} { http::formatQuery name1 ~bwelch name2 \xa1\xa2\xa2 -} {name1=%7ebwelch&name2=%c2%a1%c2%a2%c2%a2} +} {name1=~bwelch&name2=%c2%a1%c2%a2%c2%a2} test http-5.5 {http::formatQuery} { set enc [http::config -urlencoding] @@ -491,7 +491,7 @@ test http-5.5 {http::formatQuery} { set res [http::formatQuery name1 ~bwelch name2 \xa1\xa2\xa2] http::config -urlencoding $enc set res -} {name1=%7ebwelch&name2=%a1%a2%a2} +} {name1=~bwelch&name2=%a1%a2%a2} test http-6.1 {http::ProxyRequired} { http::config -proxyhost [info hostname] -proxyport $port -- cgit v0.12