cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Re: Reuse conditions of ssh connection?

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Fri, 16 Mar 2012 16:29:01 +0100 (CET)

On Fri, 16 Mar 2012, Ellié Computing Open Source Program wrote:

>> lib/url.c:ConnectionExists() is the function that checks if a new request
>> can re-use an existing connection.
>
> I have a problem, when I try to access check->data members it seems that I
> get default values, and not those provided when the original SFTP request
> happened. Am I right?

No, you're not. The connectdata struct is associated with a physical
connection. Each such connectdata is either independent (like when put in the
connection pool within a multi handle) or associated with a SessionHandle
(->data points to that). There is never any SessionHandle struct kept around
with just default values.

> should I use another SessionHandle / "data"?

You compare connections, that means fields of two connectdata structs. The
SessionHandle is basically where values are copied from to the connectdata
struct at the time that struct is allocated and most likely the connections
you compare point to the same SessionHandle struct.

> Part of the authentication information is indeed provided inside "data->set"
> with the combination of being "statefully authenticated" on the contrary to
> most other protocols.

If that is true that it is a bug. The values in 'data->set' are what was set
by the user with setopt() and they must remain like that. If libcurl needs to
update anything, that anything needs to be somewhere else. If a connection
needs to remember any value from data->set, then that data needs to be stored
in the connectdata struct so that you can compare..

-- 
  / daniel.haxx.se

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2012-03-16