nl_tokens: parses a simple hostname : port argument defaulting to port 80 if not specified
pl_tokens: function parseTargetServer ( value ) { var target , path ; // insert a http protocol handler if not found in the string if ( value . indexOf ( 'http://' ) !== 0 && value . indexOf ( 'https://' ) !== 0 ) { value = 'http://' + value + '/' ; } target = url . parse ( value ) ; path = target . path ; // url.parse() will default to '/' as the path // we can safely strip this for regexp matches to function properly if ( path === '/' ) { path = '' ; } // support an explict set of regexp unnamed captures (prefixed with `$`) // if the pattern doesn't include a match operator like '$1', '$2', '$3', // then use the RegExp lastMatch operator `$&` if the rewrite rule if ( / \$\d / . <mask> ( path ) === false ) { path = [ path , '$&' ] . join ( '' ) ; } return { host : target . hostname , // inject a default port if one wasn't specified port : target . port || ( ( target . protocol === 'https:' ) ? 443 : 80 ) , originalPort : target . port , protocol : target . protocol , path : path } ; }