TSUrlCreate¶
Traffic Server URL object construction API.
Synopsis¶
#include <ts/ts.h>
-
TSReturnCode
TSUrlCreate(TSMBuffer bufp, TSMLoc * locp)¶
-
TSParseResult
TSUrlParse(TSMBuffer bufp, TSMLoc offset, const char ** start, const char * end)¶
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.
TSUrlCreate() creates a new URL within the marshal buffer
:arg:`bufp`. Release the resulting handle with a call to
TSHandleMLocRelease().
TSUrlClone() copies the contents of the URL at location :arg:`src_url`
within the marshal buffer :arg:`src_bufp` to a location within the marshal
buffer :arg:`dest_bufp`. Release the returned handle with a call to
TSHandleMLocRelease().
TSUrlCopy() copies the contents of the URL at location :arg:`src_url`
within the marshal buffer :arg:`src_bufp` to the location :arg:`dest_url`
within the marshal buffer dest_bufp. TSUrlCopy() works correctly even if
:arg:`src_bufp` and :arg:`dest_bufp` point to different marshal buffers. It
is important for the destination URL (its marshal buffer and TSMLoc)
to have been created before copying into it.
TSUrlParse() parses a URL. The :arg:`start` pointer is both an input
and an output parameter and marks the start of the URL to be parsed. After a
successful parse, the :arg:`start` pointer equals the :arg:`end`
pointer. The :arg:`end` pointer must be one byte after the last character you
want to parse. The URL parsing routine assumes that everything between
:arg:`start` and :arg:`end` is part of the URL. It is up to higher level
parsing routines, such as TSHttpHdrParseReq(), to determine the actual
end of the URL.
Return Values¶
The TSUrlParse() function returns a TSParseResult, where
TS_PARSE_ERROR indicates an error. Success is indicated by one of
TS_PARSE_DONE, TS_PARSE_OK or TS_PARSE_CONT. The other
APIs all return a TSReturnCode, indicating success
(TS_SUCCESS) or failure (TS_ERROR) of the operation.
See Also¶
TSAPI(3ts), TSMBufferCreate(3ts), TSUrlHostGet(3ts), TSUrlHostSet(3ts), TSUrlStringGet(3ts), TSUrlPercentEncode(3ts)