This proposal is to add a configuration variable
(proxy.config.http.pristine_client_req) which enables making a copy of the user
agent request before any transaction hooks, and an API call to retrieve the
pristine copy. In addition, it would rename TSHttpTxnPristineUrlGet as
TSHttpTxnPreRemapUrlGet to avoid confusion. The former name would be retained
but be deprecated and slated for removal in ATS 11. The pristine request would
be read only, not changeable by plugins. This solves an internal LinkedIn
issue, as well as providing a capability that several people have requested.
In the long run, I would like to
1) Remove this.
2) Make the client request immutable to replace it.
3) Create the proxy request before ReadHeqHdrHook so plugin can change that
directly, rather than the UA request to be later copied to the proxy request.
That is currently a step too far, but this is a good start.
TSHttpTxnPreRemapUrlGet
***********************
Synopsis
========
.. code-block:: c
#include <ts/ts.h>
.. function:: TSReturnCode TSHttpTxnPreRemapUrlGet(TSHttpTxn txnp, TSMBuffer
bufp, TSMLoc offset)
.. function:: TSReturnCode TSHttpTxnPristineUrlGet(TSHttpTxn txnp, TSMBuffer
bufp, TSMLoc offset)
Description
===========
Get the user agent request URL as it was before remapping. These two functions
are identical.
:code:`TSHttpTxnPristineUrlGet` exists for backwards compatibility and is
deprecated due to the
misleading name. :code:`TSHttpTxnPreRemapUrlGet` may be deprecated in the
future in favor of
:c:func:`TSHttpTxnPristineClientReqGet` although these functions may not
produce the same
results - differences may exist if the user agent request URL is modified in
callbacks on hooks
before remapping.
TSHttpTxnPristineClientReqGet
*****************************
Synopsis
========
.. code-block:: c
#include <ts/ts.h>
.. function:: TSReturnCode TSHttpTxnPristineClientReqGet(TSHttpTxn txnp,
TSMBuffer * bufp, TSMLoc * offset)
Description
===========
Get the pristine client request. The :arg:`txnp` must be passed in and the
values in :arg:`bufp` and
:arg:`offset` are updated to refer to the pristine client request in the
transaction. This is a
read only value and may not be changed. It is a copy of the client request
before any transaction
callbacks have been invoked.
The values placed in :arg:`bufp` and :arg:`offset` are stable for the
transaction and need only be
retrieved once per transaction. Note these values are valid only if this
function returns
:code:`TS_SUCCESS`.
.. note::
The pristine client request is available only if
:ts:cv:`proxy.config.http.pristine_client_req`
is set to a non-zero value. If not this function will return :cod