diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2013-04-12 11:31:30 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2013-04-12 11:31:30 (GMT) |
commit | e744580767afeef994ed932dd111ff5d2bd52383 (patch) | |
tree | fbbce02aaa3df8e5cba876a848da66fb42c1042b /library | |
parent | 96a623761bf899e6628ef4f82ecbf1e78cb53466 (diff) | |
parent | 40691feec1993222d76235c047d25b488d08310b (diff) | |
download | tcl-e744580767afeef994ed932dd111ff5d2bd52383.zip tcl-e744580767afeef994ed932dd111ff5d2bd52383.tar.gz tcl-e744580767afeef994ed932dd111ff5d2bd52383.tar.bz2 |
merge trunk
Diffstat (limited to 'library')
-rw-r--r-- | library/http/http.tcl | 19 | ||||
-rw-r--r-- | library/http/pkgIndex.tcl | 2 |
2 files changed, 15 insertions, 6 deletions
diff --git a/library/http/http.tcl b/library/http/http.tcl index 98066af..6550978 100644 --- a/library/http/http.tcl +++ b/library/http/http.tcl @@ -11,7 +11,7 @@ package require Tcl 8.6- # Keep this in sync with pkgIndex.tcl and with the install directories in # Makefiles -package provide http 2.8.6 +package provide http 2.8.7 namespace eval http { # Allow resourcing to not clobber existing data @@ -394,13 +394,16 @@ proc http::geturl {url args} { # First, before the colon, is the protocol scheme (e.g. http) # Second, for HTTP-like protocols, is the authority # The authority is preceded by // and lasts up to (but not including) - # the following / and it identifies up to four parts, of which only one, - # the host, is required (if an authority is present at all). All other - # parts of the authority (user name, password, port number) are optional. + # the following / or ? and it identifies up to four parts, of which + # only one, the host, is required (if an authority is present at all). + # All other parts of the authority (user name, password, port number) + # are optional. # Third is the resource name, which is split into two parts at a ? # The first part (from the single "/" up to "?") is the path, and the # second part (from that "?" up to "#") is the query. *HOWEVER*, we do # not need to separate them; we send the whole lot to the server. + # Both, path and query are allowed to be missing, including their + # delimiting character. # Fourth is the fragment identifier, which is everything after the first # "#" in the URL. The fragment identifier MUST NOT be sent to the server # and indeed, we don't bother to validate it (it could be an error to @@ -437,7 +440,7 @@ proc http::geturl {url args} { ) (?: : (\d+) )? # <port part of authority> )? - ( / [^\#]*)? # <path> (including query) + ( [/\?] [^\#]*)? # <path> (including query) (?: \# (.*) )? # <fragment> $ } @@ -481,6 +484,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 e4c0e11..e485046 100644 --- a/library/http/pkgIndex.tcl +++ b/library/http/pkgIndex.tcl @@ -1,2 +1,2 @@ if {![package vsatisfies [package provide Tcl] 8.6-]} {return} -package ifneeded http 2.8.6 [list tclPkgSetup $dir http 2.8.6 {{http.tcl source {::http::config ::http::formatQuery ::http::geturl ::http::reset ::http::wait ::http::register ::http::unregister ::http::mapReply}}}] +package ifneeded http 2.8.7 [list tclPkgSetup $dir http 2.8.7 {{http.tcl source {::http::config ::http::formatQuery ::http::geturl ::http::reset ::http::wait ::http::register ::http::unregister ::http::mapReply}}}] |