TSHttpHdrHostGet
Synopsis
#include <ts/ts.h>
Description
Get the host for the request. bufp and offset must reference an
HTTP request header. A pointer to the host is returned and the length is stored
in the int pointed at by length. Note the returned text may not
be null terminated. The URL in the request is checked first then the Host
header field.
Note
This is much faster than calling TSHttpTxnEffectiveUrlStringGet() and
extracting the host from the result.
Note
TSHttpHdrHostGet() checks both the URL and the Host header field,
making it reliable at any hook stage. In contrast, TSUrlHostGet()
operates only on the URL object obtained from TSHttpHdrUrlGet(). In
early hooks such as TS_HTTP_READ_REQUEST_HDR_HOOK, the URL object may
not yet be fully parsed, and TSUrlHostGet() may return NULL even
when a Host header is present.
See Also
TSUrlHostGet(),
TSHttpHdrUrlGet(),
TSHttpTxnEffectiveUrlStringGet()