Re: Proxies, how to determine response body length

Jan Novy wrote:
> After reading RFC2616 I'am not sure how HTTP1.1 proxy server can 
> determine response body length on client-proxy side connection 
> when this length was determined by the server closing the connection
> on proxy-originserver side connection.

That's correct, it can't.  The proxy does not know the body length
until the end of the body.  It is the same if the body is transmitted
with chunked encoding.

> I'am not sure that proxy server can determine it by closing the
> connection, because for some particular client-proxy connection
> proxy can have many persistent connections (to different origin
> servers) opened so determining response body length by closing
> client-proxy connection would cause loss of remaining
> proxy-originserver persistent connections I think.

If there are many persistent client-proxy connections open, that's
irrelevant.  A message is terminated by closing only the connection
for that message: the other client-proxy connections aren't affected.

That's what you need to do if the client speaks only HTTP/1.0.
Alternatively you can buffer the message until you know the length,
which is good idea for short messages where the whole message arrives
in a very short time.

If the client speaks HTTP/1.1, then you can send the body using
chunked encoding over the client-proxy connection, at the same time as
receiving it over the proxy-server (or proxy-proxy) connection.

-- Jamie

Received on Monday, 12 July 2004 07:31:57 UTC