curl-library
RE: ssl and libcurl issue
Date: Wed, 20 Jul 2005 19:01:03 +0200
Hi,
I just faced such problem some 2 weeks ago. What I did is replaced
the connect method that is part of the CTX to get a hold of the SSL
object when it is created. The pseudo code below sketches the recipe.
Hope it helps
Cheers,
Shmul
int (*_ssl_connect_func)(SSL *ssl);
static int ssl_connect_force_session(SSL *ssl) {
SSL_CTX* ctx = SSL_get_SSL_CTX(ssl);
// do what ever you want here, but remember to put back the original
// connect function and call it.
// it is probably useful to use the CTX support for user specific data
// i.e. SSL_CTX_get_ex_data
ctx->method->ssl_connect = _ssl_connect;
return ctx->method->ssl_connect(ssl);
}
static CURLcode curl_sslctx(CURL * curl, void * sslctx, void * parm) {
struct ssl_ctx_st* ctx = (struct ssl_ctx_st*)sslctx;
if ( ctx ) {
_ssl_connect_func = ctx->method->ssl_connect; // save the original
ssl_connect function
ctx->method->ssl_connect = ssl_connect_force_session;
// it is probably useful to use the CTX support for user specific data
// i.e. SSL_CTX_set_ex_data
return CURLE_OK;
}
Received on 2005-07-20