Subject: Proxy and HTTP protocol versions

From: "Sudha Subramanian" <[email-masked]>
Date: Fri, 6 Jun 2003 22:24:36 -0400 (EDT)

Hi,

I'm trying to implement a proxy server. The proxy server does nothing but 
just forwards the request to the destination server.

My question is:

1. For implementing a proxy as simple as this ( just forward request back 
and forth), do I have to bother myself with the HTTP protocol versions etc.

2. I understand from a bit of googling  that I should be removing the 
'Proxy-Connection' from the request header so that we won't have to worry 
about a broken link even if the upstream proxy does not support it. Is there 
anyother field like this that I should deal with ?  Does this apply to both 
HTTP 1.0 as well as HTTP 1.1 ?

Any help or pointers would be of great help.

-Thanks
Sub

_________________________________________________________________
Go down memory lane. Revisit the cool times. 
http://www.batchmates.com/msn.asp Reconnect with old friends!

---

From: "Joris Dobbelsteen" <[email-masked]>
Date: Sat, 7 Jun 2003 17:29:47 +0200

Proxy-Connection is not HTTP standard. It is generally used by HTTP/1.0 to
distinguish between the connection of the proxy to the client and the proxy to
the server.

Making a simple proxy might be harder than you expect:
Just ensure this:
* Each request requires a new connection. This will solve some problems for you.

To do this you must ensure you send:
* Connection: Close
upstream and downstream (HTTP/1.1)

For compatibility you must send
* Proxy-connection: Close
downstream (unless communicating with a upstream proxy).

Generally I would recommend to get all this connection-specific stuff out of the
way:
Replace "Connection" with above upstream and downstream.
Also you should remove "Proxy-*" from the request upstream.
  Might want to consider Proxy-Authentication, etc...

Note that when any client closes the connection, the other one should be closed
also.

- Joris

>-----Original Message-----
>From: [email-masked]
>[mailto:[email-masked]]On
>Behalf Of Sudha Subramanian
>Sent: Saturday, 7 June 2003 4:25
>To: [email-masked]
>Subject: Proxy and HTTP protocol versions
>
>Hi,
>

---

From: Alex Rousskov <[email-masked]>
Date: Sat, 7 Jun 2003 10:31:29 -0600 (MDT)

Sub,

	There are a few questions you need to answer before we can
help you with the design and minimal feature set:

	1. Will your proxy forward all requests to one configured
	   server? Or will it need to look at requested URLs and
	   forward requests to corresponding servers?

	2. Is performance important? Do you want your proxy to cache
	   responses?

	3. Will you proxy do anything other than forwarding messages?
	   That is, why do you need a proxy?

Your answers will determine how much HTTP corners you can cut. If it
turns out that your proxy needs to support HTTP/1.1, then you would
have to handle versions and *Connection headers correctly, among other
things. In that case, I would not recommend just removing
Proxy-Connection; a lot more work needs to be done to survive in a
general HTTP environment (RFC 2616 defines most of what needs to be
implemented in that case).

Alex.

-- 
                            | HTTP performance - Web Polygraph benchmark
www.measurement-factory.com | HTTP compliance+ - Co-Advisor test suite
                            | all of the above - PolyBox appliance

---

From: Robert Olofsson <[email-masked]>
Date: Sat, 07 Jun 2003 19:02:18 +0200

Sudha Subramanian wrote:

>  I'm trying to implement a proxy server. The proxy server does nothing
>  but just forwards the request to the destination server.

Then why do you need a proxy? And why can't you use an existing proxy?

>  1. For implementing a proxy as simple as this ( just forward request
>  back and forth), do I have to bother myself with the HTTP protocol
>  versions etc.

You probably will want to do that, although if you close all connection
always you can probably ignore it for starters.

>  'Proxy-Connection' from the request header so that we won't have to
>  worry about a broken link even if the upstream proxy does not support
>  it. Is there anyother field like this that I should deal with ? Does
>  this apply to both HTTP 1.0 as well as HTTP 1.1 ?

Proxy-Connection is not a standard header and it can be good to remove it,
the headers you should remove even for this simple proxy can be found
in §13.5.1 in rfc 2616 (which can be found at 
http://www.ietf.org/rfc/rfc2616.txt).

Setting "Connection: close" and removing any "Keep-Alive", 
"Proxy-Authenticate"
and "Proxy-Authorization" should probably work for most sites. 

For HTTP/1.0 (rfc 1945) there are no hop-headers mentioned so If you do 
HTTP/1.0
you should be able to forward all headers and still follow the 
specification. In that
case you should make sure that the request your proxy forwards is HTTP/1.0.

/robo