]> granicus.if.org Git - apache/commitdiff
calculate VHostID length at startup rather than request time.
authorDoug MacEachern <dougm@apache.org>
Wed, 28 Nov 2001 05:50:55 +0000 (05:50 +0000)
committerDoug MacEachern <dougm@apache.org>
Wed, 28 Nov 2001 05:50:55 +0000 (05:50 +0000)
change ap_md5() call in ssl_hook_pre_connection() to ap_md5_binary()
that uses the precalculated sc->nVHostID_length to avoid a strlen() call.

PR:
Obtained from:
Submitted by:
Reviewed by:

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@92216 13f79535-47bb-0310-9956-ffa450edef68

modules/ssl/mod_ssl.c
modules/ssl/mod_ssl.h
modules/ssl/ssl_engine_init.c

index 37f92c5c25a105dc8a5293a56f149787408faef7..621a3439f90e83d909d173fb926fab703c573b54 100644 (file)
@@ -262,7 +262,7 @@ static int ssl_hook_pre_connection(conn_rec *c)
         return DECLINED; /* XXX */
     }
     SSL_clear(ssl);
-    cpVHostMD5 = ap_md5(c->pool, sc->szVHostID);
+    cpVHostMD5 = ap_md5_binary(c->pool, sc->szVHostID, sc->nVHostID_length);
     if (!SSL_set_session_id_context(ssl, (unsigned char *)cpVHostMD5,
                                     MD5_DIGESTSIZE*2)) {
         ssl_log(c->base_server, SSL_LOG_ERROR|SSL_ADD_SSLERR,
index 06c035e17705e4c48f0eaefc3667dec1403e1449..4d3615b3eb5444aa74ef2361899d385fdccb5ecb 100644 (file)
@@ -498,6 +498,7 @@ typedef struct {
  */
 typedef struct {
     const char  *szVHostID;
+    int          nVHostID_length;
     BOOL         bEnabled;
     apr_table_t *ap_server_ctx;
     const char  *szPublicCertFile[SSL_AIDX_MAX];
index ab98d808b9dac116d784ecb16a6b6d4d3acb72de..3778fc950055b3407989ca1957bef0b7e5cd2705 100644 (file)
@@ -477,6 +477,7 @@ void ssl_init_ConfigureServer(server_rec *s, apr_pool_t *p, SSLSrvConfigRec *sc)
      * Create the server host:port string because we need it a lot
      */
     sc->szVHostID = cpVHostID = ssl_util_vhostid(p, s);
+    sc->nVHostID_length = strlen(sc->szVHostID);
 
     /*
      * Now check for important parameters and the