You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Yoav Weiss <ye...@gmail.com> on 2006/05/09 23:44:29 UTC

[users@httpd] Accumulating response bucket brigades

Hi all,

I'm an apache newbie, and I'm currently writing a new output filter.
I'm interested in accumulating a full response in the filter, before I
modify the data. I am aware of the performance implications, but it's
something I must do in order to manipulate the content correctly. I
should also state that most of the responses arrive from the web
(using mod_proxy), so the response time and number of brigades vary
according to network conditions.

I was thinking along the lines of using ap_save_brigade on all the
brigades except for the last one, but I don't know which one is
last...
Is there a trivial way of accumulating the response brigades? or
knowing which brigade is last?
I can always count bytes (in case of content-length) or look for a
zero sized chunk (in case of content-encoding: chunked), but I'm
guessing that work is already done by the server's internals.

Thanks in advance,
Yoav Weiss.

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Accumulating response bucket brigades

Posted by Nick Kew <ni...@webthing.com>.
On Tuesday 09 May 2006 22:44, Yoav Weiss wrote:
> Hi all,
>
> I'm an apache newbie, and I'm currently writing a new output filter.
> I'm interested in accumulating a full response in the filter, before I
> modify the data. I am aware of the performance implications, but it's
> something I must do in order to manipulate the content correctly.

Create a brigade in your filter, and transfer all incoming buckets
into it after using setaside to ensure they don't go out of scope.
When you see an EOS bucket, do your processing.

> should also state that most of the responses arrive from the web
> (using mod_proxy), so the response time and number of brigades vary
> according to network conditions.

Where the data come from is irrelevant.  If it works with mod_proxy,
it'll work equally with a local generator.

This would be more on-topic on the apache-modules list.

-- 
Nick Kew

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org