cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: getinfo CURLINFO_LOCAL* broken (reused connections)

From: Yang Tse <yangsita_at_gmail.com>
Date: Fri, 26 Nov 2010 17:10:55 +0100

2010/11/25 Frank Meier wrote:

> [...] function Curl_updateconninfo() was changed [...]
> [...]
> since git commit feecf63a9607cce4c9339ad9f1b5a550e6bd2d98 (see below) the
> whole function is skipped if the connection is being reused.
>
> +  if(conn->bits.reuse)
> +    /* reusing same connection */
> +    return;
> +
>
> the problem now is if a connection is being reused the information is not
> stored in the curlhandle, so the info is not available for CURLINFO_LOCAL*
> calls.
>
> I propose just to revert the commit above. (patch attached)

Can you reproduce the issue with current git version?

Could you provide a code snippet that would expose the issue, or even
better a new test case that exposes it?

In any case...

The only place in whole library where bits.reuse is set TRUE is in
function reuse_conn() in url.c, and when that happens reuse_conn() has
already copied the SessionHandle data pointer from the old conn to the
new one, which should mean that info.ip, info.port, info.localip, and
info.localport data is already set for the reused connection.

Making Curl_updateconninfo() unconditionally execute its code for
reused connections introduces a needless performance penalty. If
there's actually a problem, we better fix the origin of the problem.

-- 
-=[Yang]=-
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html
Received on 2010-11-26