How to pass information from REQMOD to RESPMOD?

Created by Alex Rousskov on on 2012-10-31
Keywords:
Last updated by:
Alex Rousskov on on 2017-06-06

If your host application supports meta-information sharing among adaptation transactions, then you can use that feature to set a meta header in the REQMOD transaction and then receive that meta header in the RESPMOD transaction. Your adapter code can use the meta header value to tie different eCAP (and even ICAP!) transactions together (e.g., lookup some shared state in a global map using the meta header value as the key).

To "send" a meta header to the host application, your libecap::adapter::Xaction child must implement the libecap::Options API. To "receive" a meta header from the host application, your adapter transaction should use the libecap::Options API of the corresponding libecap::host::Xaction.

Meta headers are not visible to HTTP clients and servers.

For example, if you are using Squid, see the adaptation_masterx_shared_names option in squid.conf.documented.

For host applications that do not support meta-information sharing, the REQMOD transaction would have to add a custom HTTP header to the request so that the RESPMOD transaction can see it. Ideally, you would then configure your host application to remove that custom request header before it goes out to the origin server so that the information is not leaked outside the host application and your adaptation code.