You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modules-dev@httpd.apache.org by Jodi Bosa <jo...@gmail.com> on 2008/11/24 18:25:47 UTC

proxy - as a Handler or a Filter?

I need to do write a proxy protocol converter and have not found any
comparable examples - basically a proxy that is communicating HTTP with a
client but

communicates in another protocol with a backend server - with multiple
requests & responses on same connection (so basically KeepAlive's between
client&proxy

and proxy&server).  In other words, the proxy-server communication needs to
maintain the same connection due to a very high cost overhead of creating
new

connections (much more than TCP).  Is there any other examples that do this?


Right now I am thinking of writing this as an Apache Handler that reads data
from a client into a Bucket Brigade and then the Handler create it's own
Filter

chain and invokes the Filter chain on that Bucket Brigade.

I have debated between implementing this as a Filter vs Handler but fear
that as a Filter I might face more complexity issues in handling multiple
requests.

Implemented as a Handler it would essentially block over the entire
communication and although this might cause some scalability issues (e.g.
use up one thread

per client and so restrict maximum number of simultaneous) I think as a
Handler would be more straightforward to implement (a simple while-loop).

I do realize implementing it as a Filter would be much more flexible
(especially in customer configuration) but don't know whether I want to
support all the

possible combinations anyways.

But implementing it as a Handler and then writing other portions as Filters
and having the Handler create it's own Filter chain might give me a hybrid
and

leverage the power of Filters (although maybe might limit the
configurability of this).


Does this sound reasonable?