Oleg Kalnichevski wrote:
I developed a sample application demonstrating how HttpCore NIO can be
used to put together a simple reverse HTTP proxy, which nonetheless can
handle an arbitrary number of simultaneous connections with as little as
two I/O threads.

Sorry to dissapoint, but I find that hard to believe. Now I may have missed something, but still. Which thread do dns lookups?
Do you use any non blocking dns library for this proxy?

InetAddress.getByName is a method that is native and single threaded and
it is a method that can block for a long time. How it behaves depend on
the operating system and system libraries. For my proxy I have a
pluggable system for dns lookups, the default is the dnsjava library,
but on MS windows InetAddress seems to cause less problems.

As always, code reviews, comments, ideas or critique will be greatly
appreciated.

Looking at the proxy parts on a higher level I also find a few problems.
Most of these problems will not cause any problems for nice clients, like IE or Firefox, but other clients may cause problems.

One thing that seems to be broken is the handling of hop headers:
Connection,Proxy-Connection,Keep-Alive,Public,Transfer-Encoding,
Upgrade,Proxy-Authorization,TE,Proxy-Authenticate,Trailer are all hop
headers and needs to be removed from one request, I did not find that
happening in the code. A few of the headers seems to be handled.

If you want to follow the rfc correctly you also have to make sure you
have a Host and a Date header in the request if you do HTTP/1.1 request
(which it looks like). Well, actually it looks like you forward the
client request version and that is not correct according to the rfc, you
have to set the http request version to the one the proxy handles, so
that looks like a violation of the rfc.

I am also not sure how you handle chunked response and forwarding to a
HTTP/1.0 client, but I have not really tried to figure that out.
Many HTTP/1.1 servers will send chunked data when given a HTTP/1.1
request.

I have only looked at the code for a few minutes so I have probably
missed many things.

/robo

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to