You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@trafficserver.apache.org by Sandeep Davu <sa...@gmail.com> on 2015/02/11 20:35:43 UTC

Sending chunked data on intercept plugins

How to send chunked data on Server Intercept Plugin? The content length is
not known before hand. Idea is to stream data as it becomes available.  I
am assuming the intercept send data needs to know that the data is chunked.

Any ideas?


Sandeep.

Re: Sending chunked data on intercept plugins

Posted by gang li <po...@gmail.com>.
Suppose you begin to write data to the TSVConn which is got from
continuation's handler with TS_EVENT_NET_ACCEPT  event, you can insert the
'Transfer-Encoding: chunked'  in the response header, and then when you got
a data segment from other place, just wrap it in chunked format.

On Thu, Feb 12, 2015 at 6:49 AM, Sandeep Davu <sa...@gmail.com>
wrote:

> Thanks,
>
> I was a little confused about this part. I was looking for helper function
> which can do it for me. I see that ChunkHandler has access to chunk and
> dechunk, but is not exposed. Should this be exposed for making the plugin
> experience easier?
>
> Sandeep.
>
> On Wed, Feb 11, 2015 at 2:38 PM, Brian Geffon <br...@gmail.com>
> wrote:
>
> > You'll have to handle chunking yourself; it should be relatively simple
> to
> > do.
> >
> > On Wed, Feb 11, 2015 at 2:22 PM, Sandeep Davu <sa...@gmail.com>
> > wrote:
> >
> > > Who will be responsible for chunking? Plugin has access to response and
> > not
> > > chunked data. If Intercept writes  a raw byte stream, how does the data
> > get
> > > chunked?
> > >
> > >
> > > Sandeep.
> > >
> > > On Wed, Feb 11, 2015 at 1:51 PM, James Peach <jp...@apache.org>
> wrote:
> > >
> > > >
> > > > > On Feb 11, 2015, at 11:35 AM, Sandeep Davu <sandeep.davu@gmail.com
> >
> > > > wrote:
> > > > >
> > > > > How to send chunked data on Server Intercept Plugin? The content
> > length
> > > > is
> > > > > not known before hand. Idea is to stream data as it becomes
> > > available.  I
> > > > > am assuming the intercept send data needs to know that the data is
> > > > chunked.
> > > >
> > > > The server intercept writes a raw byte stream, so you can do whatever
> > you
> > > > want. If you want to write a chinked response, just write it as if
> your
> > > > plugin was a real HTTP server (which, effectively, it is). Take a
> look
> > at
> > > > example/intercept/intercept.cc.
> > > >
> > > > J
> > > >
> > > >
> > >
> >
>

Re: Sending chunked data on intercept plugins

Posted by Sandeep Davu <sa...@gmail.com>.
Thanks,

I was a little confused about this part. I was looking for helper function
which can do it for me. I see that ChunkHandler has access to chunk and
dechunk, but is not exposed. Should this be exposed for making the plugin
experience easier?

Sandeep.

On Wed, Feb 11, 2015 at 2:38 PM, Brian Geffon <br...@gmail.com> wrote:

> You'll have to handle chunking yourself; it should be relatively simple to
> do.
>
> On Wed, Feb 11, 2015 at 2:22 PM, Sandeep Davu <sa...@gmail.com>
> wrote:
>
> > Who will be responsible for chunking? Plugin has access to response and
> not
> > chunked data. If Intercept writes  a raw byte stream, how does the data
> get
> > chunked?
> >
> >
> > Sandeep.
> >
> > On Wed, Feb 11, 2015 at 1:51 PM, James Peach <jp...@apache.org> wrote:
> >
> > >
> > > > On Feb 11, 2015, at 11:35 AM, Sandeep Davu <sa...@gmail.com>
> > > wrote:
> > > >
> > > > How to send chunked data on Server Intercept Plugin? The content
> length
> > > is
> > > > not known before hand. Idea is to stream data as it becomes
> > available.  I
> > > > am assuming the intercept send data needs to know that the data is
> > > chunked.
> > >
> > > The server intercept writes a raw byte stream, so you can do whatever
> you
> > > want. If you want to write a chinked response, just write it as if your
> > > plugin was a real HTTP server (which, effectively, it is). Take a look
> at
> > > example/intercept/intercept.cc.
> > >
> > > J
> > >
> > >
> >
>

Re: Sending chunked data on intercept plugins

Posted by Brian Geffon <br...@gmail.com>.
You'll have to handle chunking yourself; it should be relatively simple to
do.

On Wed, Feb 11, 2015 at 2:22 PM, Sandeep Davu <sa...@gmail.com>
wrote:

> Who will be responsible for chunking? Plugin has access to response and not
> chunked data. If Intercept writes  a raw byte stream, how does the data get
> chunked?
>
>
> Sandeep.
>
> On Wed, Feb 11, 2015 at 1:51 PM, James Peach <jp...@apache.org> wrote:
>
> >
> > > On Feb 11, 2015, at 11:35 AM, Sandeep Davu <sa...@gmail.com>
> > wrote:
> > >
> > > How to send chunked data on Server Intercept Plugin? The content length
> > is
> > > not known before hand. Idea is to stream data as it becomes
> available.  I
> > > am assuming the intercept send data needs to know that the data is
> > chunked.
> >
> > The server intercept writes a raw byte stream, so you can do whatever you
> > want. If you want to write a chinked response, just write it as if your
> > plugin was a real HTTP server (which, effectively, it is). Take a look at
> > example/intercept/intercept.cc.
> >
> > J
> >
> >
>

Re: Sending chunked data on intercept plugins

Posted by Sandeep Davu <sa...@gmail.com>.
Who will be responsible for chunking? Plugin has access to response and not
chunked data. If Intercept writes  a raw byte stream, how does the data get
chunked?


Sandeep.

On Wed, Feb 11, 2015 at 1:51 PM, James Peach <jp...@apache.org> wrote:

>
> > On Feb 11, 2015, at 11:35 AM, Sandeep Davu <sa...@gmail.com>
> wrote:
> >
> > How to send chunked data on Server Intercept Plugin? The content length
> is
> > not known before hand. Idea is to stream data as it becomes available.  I
> > am assuming the intercept send data needs to know that the data is
> chunked.
>
> The server intercept writes a raw byte stream, so you can do whatever you
> want. If you want to write a chinked response, just write it as if your
> plugin was a real HTTP server (which, effectively, it is). Take a look at
> example/intercept/intercept.cc.
>
> J
>
>

Re: Sending chunked data on intercept plugins

Posted by James Peach <jp...@apache.org>.
> On Feb 11, 2015, at 11:35 AM, Sandeep Davu <sa...@gmail.com> wrote:
> 
> How to send chunked data on Server Intercept Plugin? The content length is
> not known before hand. Idea is to stream data as it becomes available.  I
> am assuming the intercept send data needs to know that the data is chunked.

The server intercept writes a raw byte stream, so you can do whatever you want. If you want to write a chinked response, just write it as if your plugin was a real HTTP server (which, effectively, it is). Take a look at example/intercept/intercept.cc.

J