You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@trafficserver.apache.org by Anil J <an...@gmail.com> on 2013/04/29 06:58:24 UTC

Server Transform example code.

Hi List,

In the server transform example code, transform_connect() function invokes
the (dummy) call to the remote server where the content is getting
transformed. In real implementation of this functionality, will this call
with the transformation server be synchronous or asynchronous?

I am trying to understand, when the remote server returns the transformed
content, how it will be handled to be put back into the HTTP response
message? Can you please elaborate this part a bit?

I also noted that the explanation given in developer's guide and the code
are bit different.

Thanks,
Anil.

Re: Server Transform example code.

Posted by Anil J <an...@gmail.com>.
Hi List,

Can someone provide your comment on this?

As per my understanding, when transformation vconnection transforms the
data received in the HTTP response message, it has to write it to the
"output buffer" of the output VIO.

When it has to start the compression, it calls the transform_connect()
function. In this function, I am not able to understand where this writing
to the "output buffer" is taking place before transformed data is sent to
the requesting client.

/anil.


On Mon, Apr 29, 2013 at 10:04 AM, Anil J <an...@gmail.com> wrote:

> This transformation takes place transform_buffer_event() handler
> function, when the data from the upstream is completely copied into
> the input buffer is by the continuation TSCont from write VIO.
>
> In the transform_connect() function, there is a communication with the
> remote server (socket call) as below.
>
>     200   /* TODO: This only supports IPv4, probably should be changed at
> some point, but
>     201      it's an example ... */
>     202   memset(&ip_addr, 0, sizeof(ip_addr));
>     203   ip_addr.sin_family = AF_INET;
>     204   ip_addr.sin_addr.s_addr = server_ip; /* Should be in network
> byte order */
>     205   ip_addr.sin_port = server_port;
>     206   action = TSNetConnect(contp, (struct sockaddr const*)&ip_addr);
>     207
>
> I am not able to understand as this does not seems to be actually sending
> data to the server over this socket. So when the response from socket
> (server) is indeed received, where that data will be handled to send to the
> proxy client?
>
> Thanks,
> /anil.
>
> On Mon, Apr 29, 2013 at 12:58 AM, Anil J <an...@gmail.com> wrote:
>
>> Hi List,
>>
>> In the server transform example code, transform_connect() function
>> invokes the (dummy) call to the remote server where the content is getting
>> transformed. In real implementation of this functionality, will this call
>> with the transformation server be synchronous or asynchronous?
>>
>> I am trying to understand, when the remote server returns the transformed
>> content, how it will be handled to be put back into the HTTP response
>> message? Can you please elaborate this part a bit?
>>
>> I also noted that the explanation given in developer's guide and the code
>> are bit different.
>>
>> Thanks,
>> Anil.
>>
>>
>

Re: Server Transform example code.

Posted by Anil J <an...@gmail.com>.
This transformation takes place transform_buffer_event() handler
function, when the data from the upstream is completely copied into
the input buffer is by the continuation TSCont from write VIO.

In the transform_connect() function, there is a communication with the
remote server (socket call) as below.

    200   /* TODO: This only supports IPv4, probably should be changed at
some point, but
    201      it's an example ... */
    202   memset(&ip_addr, 0, sizeof(ip_addr));
    203   ip_addr.sin_family = AF_INET;
    204   ip_addr.sin_addr.s_addr = server_ip; /* Should be in network byte
order */
    205   ip_addr.sin_port = server_port;
    206   action = TSNetConnect(contp, (struct sockaddr const*)&ip_addr);
    207

I am not able to understand as this does not seems to be actually sending
data to the server over this socket. So when the response from socket
(server) is indeed received, where that data will be handled to send to the
proxy client?

Thanks,
/anil.

On Mon, Apr 29, 2013 at 12:58 AM, Anil J <an...@gmail.com> wrote:

> Hi List,
>
> In the server transform example code, transform_connect() function invokes
> the (dummy) call to the remote server where the content is getting
> transformed. In real implementation of this functionality, will this call
> with the transformation server be synchronous or asynchronous?
>
> I am trying to understand, when the remote server returns the transformed
> content, how it will be handled to be put back into the HTTP response
> message? Can you please elaborate this part a bit?
>
> I also noted that the explanation given in developer's guide and the code
> are bit different.
>
> Thanks,
> Anil.
>
>