trafficserver-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jean Baptiste Favre <webmas...@jbfavre.org>
Subject Buffered transformation plugin question
Date Fri, 06 Dec 2013 23:09:31 GMT
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

Mime
View raw message