NaviServer - programmable web server
4.99  5.0

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

ns_parsehostport(n) 4.99.30 naviserver "NaviServer Built-in Commands"

Name

ns_parsehostport - Parse a string containing host and an optional port

Table Of Contents

Synopsis

Description

COMMANDS

ns_parsehostport ?-strict? hostport

This function interprets the provided string as host and optional port as defined by the authority elements in RFC 3986. The function supports IP-literal notation. The functionality is an subset of ns_parseurl.

When -strict is specified, the function performs a more thorough checking of the valid characters for the host (as defined in RFC 3986, but relaxed by errata #4942). Otherwise, the checking is kept to the bare minimum.

The resulting dict might contain the following elements: host, port.

EXAMPLES

 % ns_parsehostport openacs.org:443
 host openacs.org port 443
 
 % ns_parsehostport {[::1]}
 host ::1 port 80

See Also

ns_absoluteurl, ns_parsefieldvalue, ns_parseheader, ns_parseurl

Keywords

global built-in, parse