TSHttpSsnClientAddrGet

Synopsis

#include <ts/ts.h>
struct sockaddr const *TSHttpSsnClientAddrGet(TSHttpSsn ssnp)

Description

Return the socket address of the client for the HTTP session ssnp. The returned pointer references storage owned by Traffic Server and is only valid for the duration of the current callback; plugins that need to keep the value across callbacks must copy it into their own storage.

This is the session-level counterpart of TSHttpTxnClientAddrGet() and is appropriate when the caller has a session handle but no specific transaction (for example, in session-level hooks).

If the listener that accepted the connection has the pp-clnt flag set and a PROXY Protocol header was successfully parsed, the returned address is the PROXY-Protocol source address rather than the immediate TCP peer. Without pp-clnt the returned address is the immediate TCP peer even when PROXY Protocol is enabled. See Proxy Protocol for the full enumeration of surfaces gated by pp-clnt.

Return Value

A pointer to the client address, or nullptr if ssnp is invalid or no client address is available.

See Also

TSAPI(3ts), TSHttpTxnClientAddrGet(), TSNetVConnClientAddrGet()