summaryrefslogtreecommitdiffstats
path: root/library
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2013-04-09 11:04:49 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2013-04-09 11:04:49 (GMT)
commit6379f60ed8aca0d3ce1aa00314d5249bf6da6f86 (patch)
tree1d794b8df6170032d664caa0398aecfd40ec1c4c /library
parenta286f72815078b57fa95179eb4dfdf75cc43e123 (diff)
downloadtcl-6379f60ed8aca0d3ce1aa00314d5249bf6da6f86.zip
tcl-6379f60ed8aca0d3ce1aa00314d5249bf6da6f86.tar.gz
tcl-6379f60ed8aca0d3ce1aa00314d5249bf6da6f86.tar.bz2
Allow URLs that don't have a path, but a query, e.g. http://example.com?foo=bar and bump http to 2.5.8.
Diffstat (limited to 'library')
-rw-r--r--library/http/http.tcl10
-rw-r--r--library/http/pkgIndex.tcl2
2 files changed, 9 insertions, 3 deletions
diff --git a/library/http/http.tcl b/library/http/http.tcl
index ceef043..6299523 100644
--- a/library/http/http.tcl
+++ b/library/http/http.tcl
@@ -22,7 +22,7 @@
package require Tcl 8.4
# Keep this in sync with pkgIndex.tcl and with the install directories
# in Makefiles
-package provide http 2.5.7
+package provide http 2.5.8
namespace eval http {
variable http
@@ -346,7 +346,7 @@ proc http::geturl { url args } {
( [^/:\#?]+ ) # <host part of authority>
(?: : (\d+) )? # <port part of authority>
)?
- ( / [^\#?]* (?: \? [^\#?]* )?)? # <path> (including query)
+ ( [/\?] [^\#]*)? # <path> (including query)
(?: \# (.*) )? # <fragment>
$
}
@@ -389,6 +389,12 @@ proc http::geturl { url args } {
}
}
if {$srvurl ne ""} {
+ # RFC 3986 allows empty paths (not even a /), but servers
+ # return 400 if the path in the HTTP request doesn't start
+ # with / , so add it here if needed.
+ if {[string index $srvurl 0] ne "/"} {
+ set srvurl /$srvurl
+ }
# Check for validity according to RFC 3986, Appendix A
set validityRE {(?xi)
^
diff --git a/library/http/pkgIndex.tcl b/library/http/pkgIndex.tcl
index c5d2928..9bbec0a 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.4]} {return}
-package ifneeded http 2.5.7 [list tclPkgSetup $dir http 2.5.7 {{http.tcl source {::http::config ::http::formatQuery ::http::geturl ::http::reset ::http::wait ::http::register ::http::unregister ::http::mapReply}}}]
+package ifneeded http 2.5.8 [list tclPkgSetup $dir http 2.5.8 {{http.tcl source {::http::config ::http::formatQuery ::http::geturl ::http::reset ::http::wait ::http::register ::http::unregister ::http::mapReply}}}]