You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@trafficserver.apache.org by Rakesh Chhabra <ra...@gmail.com> on 2016/04/06 08:19:38 UTC

About ATS plugin to read post data

Hi,

I need to write an ATS plugin where i need to get the post body and a few
request headers in the call. And based on certain condition i want to
return the OK response from ATS itself without forwarding it to any origin
server.

I went through null transform and few other plugin, where i can hold on
post data but not sure how can i get hold on headers, which generally i
access in remap plugin using
TSMimeHdrFieldValueStringGet.

Any hints will be helpful?

Thanks,
Rakesh

Re: About ATS plugin to read post data

Posted by Brian Geffon <br...@apache.org>.
Rakesh,
Also I believe if you NEVER want to forward the request to the origin then
all you need is an Intercept Plugin, take a look at the C++ API as it makes
it pretty simple, but if you sometimes want to forward the request to the
origin based on the request body then take a look at my pull request.

Brian

On Thu, Apr 7, 2016 at 4:50 PM, Brian Geffon <br...@apache.org> wrote:

> I also have an open pull request :
> https://github.com/apache/trafficserver/pull/351 that does exactly this,
> as you've observed with transformations it's unable to block the downstream
> connection and so this pull request exposes a new API to buffer the request
> body before allowing the downstream connection to be established. The pull
> request also contains sample plugins for both the C and C++ apis.
>
> Brian
>
> On Thu, Apr 7, 2016 at 4:43 PM, Nick Kew <ni...@apache.org> wrote:
>
>> On Tue, 2016-04-05 at 23:19 -0700, Rakesh Chhabra wrote:
>> > Hi,
>> >
>> > I need to write an ATS plugin where i need to get the post body and a
>> few
>> > request headers in the call. And based on certain condition i want to
>> > return the OK response from ATS itself without forwarding it to any
>> origin
>> > server.
>>
>> Ironbee does that, including both the basics and workarounds
>> for a number of glitches.  Might be worth taking something
>> from it as a startingpoint.
>>
>> --
>> Nick Kew
>>
>>
>

Re: About ATS plugin to read post data

Posted by Brian Geffon <br...@apache.org>.
I also have an open pull request :
https://github.com/apache/trafficserver/pull/351 that does exactly this, as
you've observed with transformations it's unable to block the downstream
connection and so this pull request exposes a new API to buffer the request
body before allowing the downstream connection to be established. The pull
request also contains sample plugins for both the C and C++ apis.

Brian

On Thu, Apr 7, 2016 at 4:43 PM, Nick Kew <ni...@apache.org> wrote:

> On Tue, 2016-04-05 at 23:19 -0700, Rakesh Chhabra wrote:
> > Hi,
> >
> > I need to write an ATS plugin where i need to get the post body and a few
> > request headers in the call. And based on certain condition i want to
> > return the OK response from ATS itself without forwarding it to any
> origin
> > server.
>
> Ironbee does that, including both the basics and workarounds
> for a number of glitches.  Might be worth taking something
> from it as a startingpoint.
>
> --
> Nick Kew
>
>

Re: About ATS plugin to read post data

Posted by Nick Kew <ni...@apache.org>.
On Tue, 2016-04-05 at 23:19 -0700, Rakesh Chhabra wrote:
> Hi,
> 
> I need to write an ATS plugin where i need to get the post body and a few
> request headers in the call. And based on certain condition i want to
> return the OK response from ATS itself without forwarding it to any origin
> server.

Ironbee does that, including both the basics and workarounds
for a number of glitches.  Might be worth taking something
from it as a startingpoint.

-- 
Nick Kew