You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@trafficserver.apache.org by Juan Pablo Daniel <jp...@gmail.com> on 2014/07/31 08:16:41 UTC
Not working: TSHttpHdrDestroy ?
Hello list, I'm on a forward proxy setup working with a plugin. I need to
delete a Header that comes from the user browser so it doesn't make it to
internet.
For this I'm trying to use TSHttpHdrDestroy, but it's doing nothing.
I get the right pointer to the header, but I'ts not destroyed.
Any light on this?
This is my current code:
Thanks you!
void
remove_internalid_header(TSHttpTxn txnp, TSCont contp)
{
TSMBuffer bufp;
TSMLoc hdr_loc;
TSMLoc field_loc;
if (TSHttpTxnClientReqGet(txnp, &bufp, &hdr_loc) != TS_SUCCESS) {
TSError("couldn't retrieve client request header\n");
return;
}
field_loc = TSMimeHdrFieldFind(bufp, hdr_loc, "Inid", 4);
TSDebug("myfirstfilter", "Inid field_loc=%p\n", field_loc); //this shows
the right pointer
if (!field_loc) {
TSError("no InId field\n");
}
TSHttpHdrDestroy(bufp, hdr_loc);
if ( TSHandleMLocRelease(bufp, TS_NULL_MLOC, hdr_loc) != TS_SUCCESS) {
TSError("unable to destroy InId field\n");
}
return ;
}
Re: Not working: TSHttpHdrDestroy ?
Posted by Juan Pablo Daniel <jp...@gmail.com>.
In this case is better to have everything contained on the same plugin.
Regards,
Juan Pablo.
2014-07-31 12:31 GMT-03:00 Leif Hedstrom <zw...@apache.org>:
>
> On Jul 31, 2014, at 12:16 AM, Juan Pablo Daniel <jp...@gmail.com>
> wrote:
>
> > Hello list, I'm on a forward proxy setup working with a plugin. I need to
> > delete a Header that comes from the user browser so it doesn't make it to
> > internet.
> > For this I'm trying to use TSHttpHdrDestroy, but it's doing nothing.
> > I get the right pointer to the header, but I'ts not destroyed.
> > Any light on this?
> > This is my current code:
>
>
> Also, depending on what else your plugin is doing, your use case above is
> exactly why we have that header_rewrite plugin.
>
> — Leif
>
>
Re: Not working: TSHttpHdrDestroy ?
Posted by Leif Hedstrom <zw...@apache.org>.
On Jul 31, 2014, at 12:16 AM, Juan Pablo Daniel <jp...@gmail.com> wrote:
> Hello list, I'm on a forward proxy setup working with a plugin. I need to
> delete a Header that comes from the user browser so it doesn't make it to
> internet.
> For this I'm trying to use TSHttpHdrDestroy, but it's doing nothing.
> I get the right pointer to the header, but I'ts not destroyed.
> Any light on this?
> This is my current code:
Also, depending on what else your plugin is doing, your use case above is exactly why we have that header_rewrite plugin.
— Leif
Re: Not working: TSHttpHdrDestroy ?
Posted by Juan Pablo Daniel <jp...@gmail.com>.
This worked!
Thanks you :)
2014-07-31 6:25 GMT-03:00 Nick Kew <ni...@apache.org>:
> On Thu, 2014-07-31 at 03:16 -0300, Juan Pablo Daniel wrote:
> > Hello list, I'm on a forward proxy setup working with a plugin. I need to
> > delete a Header that comes from the user browser so it doesn't make it to
> > internet.
>
> That'll be TSMimeHdrFieldFind / TSMimeHdrFieldDestroy you're
> looking for. It's just the one MIME header!
>
> --
> Nick Kew
>
>
Re: Not working: TSHttpHdrDestroy ?
Posted by Nick Kew <ni...@apache.org>.
On Thu, 2014-07-31 at 03:16 -0300, Juan Pablo Daniel wrote:
> Hello list, I'm on a forward proxy setup working with a plugin. I need to
> delete a Header that comes from the user browser so it doesn't make it to
> internet.
That'll be TSMimeHdrFieldFind / TSMimeHdrFieldDestroy you're
looking for. It's just the one MIME header!
--
Nick Kew