On 6/10/12 9:03 PM, Leif Hedstrom wrote:
> Not sure how else to explain this. -- leif 

If it still doesn't help, maybe hop on IRC tomorrow and we can walk through
the header_filter plugin, and I'll show you how to do it using remap.config
rules.

ALso, you always have the option to implement your own "rules" for your
hooks. I.e. there's nothing preventing your from making your own config
file, telling the plugin when, and when not, to create the transform hook.
Using remap.config and the remap plugin "pattern" makes it easier though,
since you can use already existing configs / tools.

-- Leif

This would be your entire remap plugin:

TSRemapStatus
TSRemapDoRemap(void* ih, TSHttpTxn rh, TSRemapRequestInfo *rri)
{
TSHttpTxnArgSet(rh, arg_idx, static_cast<void*>1); // Tell a later hook to
create the transform
return TSREMAP_NO_REMAP;
}


In the hook, before creating the transform, you do e.g.

if (1 == static_cast<int>(TSHttpTxnArgGet(txnp, arg_idx))) {
// create the transform
...
} else { // just reenable the transaction, and do nothing }


arg_ix is a global in this case, registered when your plugin is first
loaded, e.g.

TSHttpArgIndexReserve(PLUGIN_NAME, "Decide if the transform should be
created or not", &arg_idx);

Reply via email to