NaviServer - programmable web server

[ Main Table Of Contents | Table Of Contents | Keyword Index ]

ns_parseurl(n) 4.99.19 naviserver "NaviServer Built-in Commands"

Name

ns_parseurl - Parse a URL into its components

Table Of Contents

Synopsis

Description

COMMANDS

ns_parseurl url

This function parses the provided URL into its parts and returns these in the form of a Tcl dict. The function supports IP-literal notation as specified in RFC 3986.

The provided url might be an absolute URL (containing protocol and host), a protocol agnostic URL (starting with two slashes followed by hostname, as defined in RFC 3986) or a relative url (without location).

The resulting dict might contain the following elements: proto, host, port, path, and tail.

EXAMPLES

   % ns_parseurl http://openacs.org//projects/openacs/download/
   proto http host openacs.org path /projects/openacs/download tail {}
 
   % ns_parseurl {http://[::1]:80/index.html}
   proto http host ::1 port 80 path {} tail index.html
 
   % ns_parseurl /foo/bar.html
   path foo tail bar.html

See Also

ns_absoluteurl, ns_parsefieldvalue, ns_parseheader

Keywords

global built-in, parse, url