Provided by: trafficserver-dev_9.1.3+ds-1_amd64 bug

NAME

       TSUrlHostGet - traffic Server URL component retrieval API

SYNOPSIS

          #include <ts/ts.h>

       const char *TSUrlHostGet(TSMBuffer bufp, TSMLoc offset, int *length)

       const char *TSUrlSchemeGet(TSMBuffer bufp, TSMLoc offset, int *length)

       const char *TSUrlRawSchemeGet(TSMBuffer bufp, TSMLoc offset, int *length)

       const char *TSUrlUserGet(TSMBuffer bufp, TSMLoc offset, int *length)

       const char *TSUrlPasswordGet(TSMBuffer bufp, TSMLoc offset, int *length)

       int TSUrlPortGet(TSMBuffer bufp, TSMLoc offset)

       int TSUrlRawPortGet(TSMBuffer bufp, TSMLoc offset)

       const char *TSUrlPathGet(TSMBuffer bufp, TSMLoc offset, int *length)

       const char *TSUrlHttpQueryGet(TSMBuffer bufp, TSMLoc offset, int *length)

       const char *TSUrlHttpParamsGet(TSMBuffer bufp, TSMLoc offset, int *length)

       const char *TSUrlHttpFragmentGet(TSMBuffer bufp, TSMLoc offset, int *length)

DESCRIPTION

       The  URL data structure is a parsed version of a standard internet URL. The Traffic Server
       URL API provides access to URL data stored in  marshal  buffers.  The  URL  functions  can
       create,  copy,  retrieve or delete entire URLs, and retrieve or modify parts of URLs, such
       as their host, port or scheme information.

       TSUrlSchemeGet(), TSUrlRawSchemeGet(), TSUrlUserGet(), TSUrlPasswordGet(), TSUrlHostGet(),
       TSUrlPathGet(),  TSUrlHttpParamsGet(), TSUrlHttpQueryGet() and TSUrlHttpFragmentGet() each
       retrieve an internal pointer to the specified portion of the URL from the marshall  buffer
       bufp.  The  length  of  the  returned  string is placed in length and a pointer to the URL
       portion is returned.

       If a request URL does not have a explicit scheme, TSUrlRawSchemeGet() will return null and
       set  length  to  zero.   TSUrlSchemeGet(), will return the scheme corresponding to the URL
       type (HTTP or HTTPS) if there is no explicit scheme.

       TSUrlPortGet() retrieves the port number portion of the URL located at offset  within  the
       marshal  buffer  bufp.  If  there  is  no explicit port number in the URL, a canonicalized
       valued is returned based on the URL scheme.

       TSUrlRawPortGet() also retrieves the port number portion of  the  URL  located  at  offset
       within  the  marshal  buffer bufp. If there is no explicit port number in the URL, zero is
       returned.

RETURN VALUES

       All APIs except TSUrlPortGet()  and  TSUrlRawPortGet()  return  a  string,  which  is  not
       guaranteed  to  be  NULL  terminated.  You  must  therefore always use the length value to
       determine the actual length of the returned string.

       TSUrlPortGet() simply returns the port number as an integer, possibly  canonicalized  with
       80  for  HTTP  and  443 for HTTPS schemes. If there is neither port nor scheme information
       available in the URL, 0 is returned. TSUrlRawPortGet(), by  contrast,  returns  0  in  all
       cases where the port is not explicitly present in the URL.

SEE ALSO

       TSAPI(3ts),        TSUrlCreate(3ts),        TSHttpHdrUrlGet(3ts),       TSUrlHostSet(3ts),
       TSUrlStringGet(3ts), TSUrlPercentEncode(3ts)

COPYRIGHT

       2022, dev@trafficserver.apache.org