diff options
author | Daniel Stenberg <daniel@haxx.se> | 2001-09-06 08:32:01 +0000 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2001-09-06 08:32:01 +0000 |
commit | c3b448dcea4887b281cbc8d3d706fda690fc4e4e (patch) | |
tree | b20aefc96d9d403ee1d7d7417f68f9d9c2ef76f8 /lib | |
parent | 86da31e0317773cb3a6cee21a6a97ea999aba3b3 (diff) |
moved the session ID cache state variables into the UrlState struct within
the SessionHandle. It was previously wrongly put in UserDefined
Diffstat (limited to 'lib')
-rw-r--r-- | lib/ssluse.c | 32 | ||||
-rw-r--r-- | lib/urldata.h | 5 |
2 files changed, 19 insertions, 18 deletions
diff --git a/lib/ssluse.c b/lib/ssluse.c index 2125ba914..9b40f1970 100644 --- a/lib/ssluse.c +++ b/lib/ssluse.c @@ -335,7 +335,7 @@ CURLcode Curl_SSL_InitSessions(struct SessionHandle *data, long amount) { struct curl_ssl_session *session; - if(data->set.ssl.session) + if(data->state.session) /* this is just a precaution to prevent multiple inits */ return CURLE_OK; @@ -349,8 +349,8 @@ CURLcode Curl_SSL_InitSessions(struct SessionHandle *data, long amount) /* store the info in the SSL section */ data->set.ssl.numsessions = amount; - data->set.ssl.session = session; - data->set.ssl.sessionage = 1; /* this is brand new */ + data->state.session = session; + data->state.sessionage = 1; /* this is brand new */ return CURLE_OK; } @@ -367,15 +367,15 @@ static int Get_SSL_Session(struct connectdata *conn, long i; for(i=0; i< data->set.ssl.numsessions; i++) { - check = &data->set.ssl.session[i]; + check = &data->state.session[i]; if(!check->sessionid) /* not session ID means blank entry */ continue; if(strequal(conn->name, check->name) && (conn->remote_port == check->remote_port) ) { /* yes, we have a session ID! */ - data->set.ssl.sessionage++; /* increase general age */ - check->age = data->set.ssl.sessionage; /* set this as used in this age */ + data->state.sessionage++; /* increase general age */ + check->age = data->state.sessionage; /* set this as used in this age */ *ssl_sessionid = check->sessionid; return FALSE; } @@ -413,13 +413,13 @@ int Curl_SSL_Close_All(struct SessionHandle *data) { int i; - if(data->set.ssl.session) { + if(data->state.session) { for(i=0; i< data->set.ssl.numsessions; i++) /* the single-killer function handles empty table slots */ - Kill_Single_Session(&data->set.ssl.session[i]); + Kill_Single_Session(&data->state.session[i]); /* free the cache data */ - free(data->set.ssl.session); + free(data->state.session); } return 0; } @@ -433,7 +433,7 @@ static int Store_SSL_Session(struct connectdata *conn) struct curl_ssl_session *store; int i; struct SessionHandle *data=conn->data; /* the mother of all structs */ - int oldest_age=data->set.ssl.session[0].age; /* zero if unused */ + int oldest_age=data->state.session[0].age; /* zero if unused */ /* ask OpenSSL, say please */ ssl_sessionid = SSL_get1_session(conn->ssl.handle); @@ -446,21 +446,21 @@ static int Store_SSL_Session(struct connectdata *conn) the oldest if necessary) */ /* find an empty slot for us, or find the oldest */ - for(i=0; (i<data->set.ssl.numsessions) && data->set.ssl.session[i].sessionid; i++) { - if(data->set.ssl.session[i].age < oldest_age) { - oldest_age = data->set.ssl.session[i].age; - store = &data->set.ssl.session[i]; + for(i=0; (i<data->set.ssl.numsessions) && data->state.session[i].sessionid; i++) { + if(data->state.session[i].age < oldest_age) { + oldest_age = data->state.session[i].age; + store = &data->state.session[i]; } } if(i == data->set.ssl.numsessions) /* cache is full, we must "kill" the oldest entry! */ Kill_Single_Session(store); else - store = &data->set.ssl.session[i]; /* use this slot */ + store = &data->state.session[i]; /* use this slot */ /* now init the session struct wisely */ store->sessionid = ssl_sessionid; - store->age = data->set.ssl.sessionage; /* set current age */ + store->age = data->state.sessionage; /* set current age */ store->name = strdup(conn->name); /* clone host name */ store->remote_port = conn->remote_port; /* port number */ diff --git a/lib/urldata.h b/lib/urldata.h index a8e7bfbf4..bc44254f8 100644 --- a/lib/urldata.h +++ b/lib/urldata.h @@ -139,9 +139,7 @@ struct ssl_config_data { char *random_file; /* path to file containing "random" data */ char *egdsocket; /* path to file containing the EGD daemon socket */ - struct curl_ssl_session *session; /* array of 'numsessions' size */ long numsessions; /* SSL session id cache size */ - long sessionage; /* number of the most recent session */ }; /**************************************************************************** @@ -437,6 +435,9 @@ struct UrlState { following not keep sending user+password... This is strdup() data. */ + + struct curl_ssl_session *session; /* array of 'numsessions' size */ + long sessionage; /* number of the most recent session */ }; |