You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@trafficserver.apache.org by Jean Baptiste Favre <we...@jbfavre.org> on 2013/12/06 23:54:29 UTC

Buffered plugin transformation question

Hello,

I need to cache some json API response.
The API sent only indented json.

To reduce network trafic and optimize cache, I need to be able to remove
space and new lines.

I'm considering to use gzip. Problem is, this would invalidate current
cache which is not an option. But, when ATS will revalidate URL, it'll
use gzip and both gziped & normal content will be cache.

In the meantime, I'm trying to implement a plugin to handle json
transformation.
>From what I understand, I need to write a buffered transformation plugin
to make sure I got the whole json. So I studied bnull_tranform plugin
and read the documentation.

>From what I read, I have to add my code into handle_output function.
I need to use data->output_reader to get content into a char, transform
it with json-c library function.
Char result will be added into a new TSIOBuffer.
Once done, I'll be able to write it into output_conn.

Am I right ?

My problem is that I don't know how to get data->output_reader content
as char.
As far as I've seen, output_reader is a TSIOBufferReader structure and I
can not find any definition of it.

As you may have noticed, I'm quite a newbie in C, but any advice will be
apreciated.

Best regards,
Jean-Baptiste