TSHttpTxnServerReqGet
Synopsis
#include <ts/ts.h>
-
TSReturnCode TSHttpTxnServerReqGet(TSHttpTxn txnp, TSMBuffer *bufp, TSMLoc *obj)
Description
Get the request Traffic Server is sending to the upstream (server) for the transaction txnp. bufp and obj should be valid pointers to use as return values. The call site could look something like
TSMBuffer mbuffer;
TSMLoc mloc;
if (TS_SUCCESS == TSHttpTxnServerReqGet(&mbuffer, &mloc)) {
/* Can use safely mbuffer, mloc for subsequent API calls */
} else {
/* mbuffer, mloc in an undefined state */
}
This call returns TS_SUCCESS
on success, and TS_ERROR
on failure. It is the
caller’s responsibility to see that txnp is a valid transaction.
Once the request object is obtained, it can be used to access all of the elements of the request,
such as the URL, the header fields, etc. This is also the mechanism by which a plugin can change the
upstream request, if done before the request is sent (in or before
TS_HTTP_SEND_REQUEST_HDR_HOOK
). Note that for earlier hooks, the request may not yet
exist, in which case an error is returned.