From: Doug MacEachern Date: Thu, 29 Nov 2001 05:45:48 +0000 (+0000) Subject: ssl_util_getmodconfig() and ssl_util_getmodconfig_ssl() show up high X-Git-Tag: 2.0.30~345 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=29ba8b4f1d397602d2390e1c000f8645f7f895ca;p=apache ssl_util_getmodconfig() and ssl_util_getmodconfig_ssl() show up high in the gprof profile. there's no need for the "global" SSLModConfigRec to live in the s->process->pool userdata table. we now just point the SSLSrvConfigRec in each server_rec.module_config to the SSLModConfigRec so we can access it directly which is much faster. PR: Obtained from: Submitted by: Reviewed by: git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@92234 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/modules/ssl/mod_ssl.h b/modules/ssl/mod_ssl.h index 6e547c913c..93510e552c 100644 --- a/modules/ssl/mod_ssl.h +++ b/modules/ssl/mod_ssl.h @@ -200,9 +200,9 @@ (SSLConnRec *)ap_get_module_config(c->conn_config, &ssl_module) #define myConnConfigSet(c, val) \ ap_set_module_config(c->conn_config, &ssl_module, val) -#define myModConfig(srv) (SSLModConfigRec *)ssl_util_getmodconfig(srv, "ssl_module") #define mySrvConfig(srv) (SSLSrvConfigRec *)ap_get_module_config(srv->module_config, &ssl_module) #define myDirConfig(req) (SSLDirConfigRec *)ap_get_module_config(req->per_dir_config, &ssl_module) +#define myModConfig(srv) (mySrvConfig((srv)))->mc #define myCtxVarSet(mc,num,val) mc->rCtx.pV##num = val #define myCtxVarGet(mc,num,type) (type)(mc->rCtx.pV##num) @@ -498,6 +498,7 @@ typedef struct { * and all contexts) */ typedef struct { + SSLModConfigRec *mc; const char *szVHostID; int nVHostID_length; BOOL bEnabled; @@ -750,8 +751,5 @@ ssl_algo_t ssl_util_algotypeof(X509 *, EVP_PKEY *); char *ssl_util_algotypestr(ssl_algo_t); char *ssl_util_ptxtsub(apr_pool_t *, const char *, const char *, char *); void ssl_util_thread_setup(server_rec *, apr_pool_t *); -apr_status_t ssl_util_setmodconfig(server_rec *, const char *, SSLModConfigRec *); -SSLModConfigRec *ssl_util_getmodconfig(server_rec *, const char *); -SSLModConfigRec *ssl_util_getmodconfig_ssl(SSL *, const char *); #endif /* __MOD_SSL_H__ */ diff --git a/modules/ssl/ssl_engine_config.c b/modules/ssl/ssl_engine_config.c index 28c51f7638..2eb0327c8b 100644 --- a/modules/ssl/ssl_engine_config.c +++ b/modules/ssl/ssl_engine_config.c @@ -107,9 +107,13 @@ void ssl_config_global_create(server_rec *s) (void)memset(mc->pTmpKeys, 0, SSL_TKPIDX_MAX*sizeof(void *)); /* - * And push it into Apache's global context + * And push it into Apache's server config recs */ - ssl_util_setmodconfig(s, "ssl_module", mc); + while (s) { + SSLSrvConfigRec *sc = mySrvConfig(s); + sc->mc = mc; + s = s->next; + } } return; } diff --git a/modules/ssl/ssl_engine_kernel.c b/modules/ssl/ssl_engine_kernel.c index c5a5dc8af4..e67a432cdb 100644 --- a/modules/ssl/ssl_engine_kernel.c +++ b/modules/ssl/ssl_engine_kernel.c @@ -1170,7 +1170,8 @@ int ssl_hook_Fixup(request_rec *r) */ RSA *ssl_callback_TmpRSA(SSL *pSSL, int nExport, int nKeyLen) { - SSLModConfigRec *mc = ssl_util_getmodconfig_ssl(pSSL, "ssl_module"); + conn_rec *c = (conn_rec *)SSL_get_app_data(pSSL); + SSLModConfigRec *mc = myModConfig(c->base_server); RSA *rsa; rsa = NULL; @@ -1196,7 +1197,8 @@ RSA *ssl_callback_TmpRSA(SSL *pSSL, int nExport, int nKeyLen) */ DH *ssl_callback_TmpDH(SSL *pSSL, int nExport, int nKeyLen) { - SSLModConfigRec *mc = ssl_util_getmodconfig_ssl(pSSL, "ssl_module"); + conn_rec *c = (conn_rec *)SSL_get_app_data(pSSL); + SSLModConfigRec *mc = myModConfig(c->base_server); DH *dh; dh = NULL; diff --git a/modules/ssl/ssl_util.c b/modules/ssl/ssl_util.c index 171b75e1a2..c4e137cd01 100644 --- a/modules/ssl/ssl_util.c +++ b/modules/ssl/ssl_util.c @@ -305,35 +305,6 @@ char *ssl_util_ptxtsub(apr_pool_t *p, const char *cpLine, return cpResult; } -apr_status_t ssl_util_setmodconfig(server_rec *s, const char *key, - SSLModConfigRec *mc) -{ - return apr_pool_userdata_set((void *)mc, key, apr_pool_cleanup_null, - s->process->pool); -} - -SSLModConfigRec *ssl_util_getmodconfig(server_rec *s, const char *key) -{ - SSLModConfigRec *mc = NULL; - - if (apr_pool_userdata_get((void **)&mc, key, s->process->pool) - != APR_SUCCESS) { - ssl_log(s, SSL_LOG_TRACE, - "Unable to retrieve SSLModConfig from global pool"); - } - return mc; -} - -SSLModConfigRec *ssl_util_getmodconfig_ssl(SSL *ssl, const char *key) -{ - conn_rec *c = (conn_rec *)SSL_get_app_data(ssl); - SSLModConfigRec *mc = NULL; - - if (c != NULL) - mc = ssl_util_getmodconfig(c->base_server, key); - return mc; -} - #if APR_HAS_THREADS /* * To ensure thread-safetyness in OpenSSL - work in progress