httpd-modules-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jodi Bosa" <jodib...@gmail.com>
Subject Re: proxy - as a Handler or a Filter?
Date Mon, 15 Dec 2008 17:32:49 GMT
> 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?


No takers so let me try phrasing the question differently.

Need to write an Apache extension that acts as proxy between a Client and a
Server.  Debating between implementing it as a Module or as a Filter.

The 2 main constraints are:
a) connections need to remain open between requests
b) perform some translations on the requests from the client AND responses
from the server

The main reason for implementing as a Filter is that there is data being
converted.  The main reason against not implementing it as a Filter is
because the connections needs to remain open.

So I am leaning towards writing a Module and the data conversion as
Filter(s) that do the data/protocol conversions - however the Module has a
big while(1) loop that invokes the Filter(s) itself on each request &
response.


Any comments or suggestions or potential pitfalls?  How difficult is it to
invoke a Filter chain directly in my own Module?

Any comparable source to look at?

Thanks.

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message