Hi All,

Comments embedded:

> > There is a bug in HTTP module when connections are proxied and
> > the connection is persistent.
> >
> > The host:port key of the target server is put into the
> connection pool
> > rather than the host:port key of the proxy.
> >
> > The proxy connection never gets reused as the conn_pool_get
> call is passed
> > the host and port of the proxy and that is never in the pool.
> >
> > Here is a fix for this issue:
> >
> > 967c967,972
> > <         conn_pool_put(trans->conn, trans->host, trans->port);
> > ---
> > >     {
> > >         if (trans->proxying)
> > >             conn_pool_put(trans->conn, proxy_hostname,
> proxy_port) ;
> > >         else
> > >             conn_pool_put(trans->conn, trans->host, trans->port);
> > >     }
> >
> > comments!
>
> I'm not quite sure. A quick look from me uncovers this in
> gwlib/http.c:1171:get_connection():
>
>
>     if (proxy_used_for_host(trans->host)) {
>         host = proxy_hostname;
>         port = proxy_port;
>     } else {
>         host = trans->host;
>         port = trans->port;
>     }
>
> doesn't it get handled by it?!
>

This code just ensures that the proxy is used. The problem I described above
is
for managing persistent connections to proxies. A connection is considered
persistent
when the HTTP server returns a Connection Keep-Alive header. This means that
the
connection may be reused for another request by the client application, in
our case
Kannel.

Kannel manages persistent connections by using the host and port of the
target URL as
a lookup key to a dictionary. The host and port key combination for proxied
requests
is handled incorrectly by Kannel.

Scenario without proxy:

http_start_request called with a url, e.g. http://www.kannel.org
Kannel checks if use a proxy for this connection and we do not
Kannel checks if there is a connection already by passing www.kannel.org:80
into conn_pool_get, if not, Kannel creates the connection.
the webserver serves the requests and returns Connection: Keep-Alive in the
header
Kannel parses the HTTP response
Kannel marks the connection as persistent because of the connection header.
Kannel stores the connection in the connection pool with www.kannel.com:80
as
the lookup key.

All correct so far, scenario with proxy:

http_start_request called with a url, e.g. http://www.kannel.org
Kannel checks if use a proxy for this connection and we do so Kannel then
sets the host and port to use to be that of the proxy.
Kannel checks if there is a connection already by passing
proxy-host:proxy-port
into conn_pool_get, if not, Kannel creates the connection.
the webserver serves the requests and returns Connection: Keep-Alive in the
header
Kannel parses the HTTP response
Kannel marks the connection as persistent because of the connection header.
Kannel stores the connection in the connection pool with www.kannel.com:80
as
the lookup key. This is where the problem occurs. This should be the host
and port
of the proxy.

As a result of this connections to the proxy will never get reused and will
not be
closed.

Regards,
Michael.

ANAM Wireless Internet Solutions
http://www.anam.com mailto:[EMAIL PROTECTED]
+353 1 284 7555
Castle Yard, Saint Patrick's Road, Dalkey, County Dublin, Ireland




Reply via email to