TSHttpTxnStatusSet
Synopsis
#include <ts/ts.h>
-
void TSHttpTxnStatusSet(TSHttpTxn txnp, TSHttpStatus status)
-
void TSHttpTxnStatusSet(TSHttpTxn txnp, TSHttpStatus status, std::string_view setter)
Description
TSHttpTxnStatusSet() sets the transaction's internal status state, which triggers
Traffic Server's error handling system. This is typically used for access control,
authentication failures, and early transaction processing. Traffic Server will
automatically generate an appropriate error response body.
txnp is the associated transaction for the new status.
status is the HTTP status code to set.
setter (overload) is an optional identifying label for the entity setting the status (e.g., plugin name), used for logging purposes. The setter information can be retrieved using the 'prscs' log field. If empty, does not change the current setter value. Defaults to empty string.
This function is commonly used by plugins that need to terminate a transaction early
with an error status. Unlike TSHttpHdrStatusSet(), this function affects the
transaction state rather than just the HTTP headers.
The setter parameter provides a convenient way to track which component set the status
for debugging and logging purposes.
Return Values
TSHttpTxnStatusSet() returns no value.
See Also
TSHttpHdrStatusSet(3ts)