8335b1
8335b1
Ugly hack to enable mod_ssl and mod_nss to "share" hooks.
8335b1
8335b1
--- httpd-2.4.6/modules/ssl/mod_ssl.c.sslmultiproxy
8335b1
+++ httpd-2.4.6/modules/ssl/mod_ssl.c
8335b1
@@ -369,6 +369,9 @@ static SSLConnRec *ssl_init_connection_c
8335b1
     return sslconn;
8335b1
 }
8335b1
 
8335b1
+static typeof(ssl_proxy_enable) *othermod_proxy_enable;
8335b1
+static typeof(ssl_engine_disable) *othermod_engine_disable;
8335b1
+
8335b1
 int ssl_proxy_enable(conn_rec *c)
8335b1
 {
8335b1
     SSLSrvConfigRec *sc;
8335b1
@@ -377,6 +380,12 @@ int ssl_proxy_enable(conn_rec *c)
8335b1
     sc = mySrvConfig(sslconn->server);
8335b1
 
8335b1
     if (!sc->proxy_enabled) {
8335b1
+        if (othermod_proxy_enable) {
8335b1
+            ap_log_cerror(APLOG_MARK, APLOG_DEBUG, 0, c,
8335b1
+                          "mod_ssl proxy not configured, passing through to other module.");
8335b1
+            return othermod_proxy_enable(c);
8335b1
+        }
8335b1
+
8335b1
         ap_log_cerror(APLOG_MARK, APLOG_ERR, 0, c, APLOGNO(01961)
8335b1
                       "SSL Proxy requested for %s but not enabled "
8335b1
                       "[Hint: SSLProxyEngine]", sc->vhost_id);
8335b1
@@ -396,6 +405,10 @@ int ssl_engine_disable(conn_rec *c)
8335b1
 
8335b1
     SSLConnRec *sslconn = myConnConfig(c);
8335b1
 
8335b1
+    if (othermod_engine_disable) {
8335b1
+        othermod_engine_disable(c);
8335b1
+    }
8335b1
+
8335b1
     if (sslconn) {
8335b1
         sc = mySrvConfig(sslconn->server);
8335b1
     }
8335b1
@@ -612,6 +625,9 @@ static void ssl_register_hooks(apr_pool_
8335b1
     ap_hook_post_read_request(ssl_hook_ReadReq, pre_prr,NULL, APR_HOOK_MIDDLE);
8335b1
 
8335b1
     ssl_var_register(p);
8335b1
+    
8335b1
+    othermod_proxy_enable = APR_RETRIEVE_OPTIONAL_FN(ssl_proxy_enable);
8335b1
+    othermod_engine_disable = APR_RETRIEVE_OPTIONAL_FN(ssl_engine_disable);
8335b1
 
8335b1
     APR_REGISTER_OPTIONAL_FN(ssl_proxy_enable);
8335b1
     APR_REGISTER_OPTIONAL_FN(ssl_engine_disable);
8335b1
--- httpd-2.4.6/modules/ssl/ssl_engine_vars.c.sslmultiproxy
8335b1
+++ httpd-2.4.6/modules/ssl/ssl_engine_vars.c
8335b1
@@ -53,10 +53,15 @@ static void  ssl_var_lookup_ssl_cipher_b
8335b1
 static char *ssl_var_lookup_ssl_version(apr_pool_t *p, char *var);
8335b1
 static char *ssl_var_lookup_ssl_compress_meth(SSL *ssl);
8335b1
 
8335b1
+static APR_OPTIONAL_FN_TYPE(ssl_is_https) *othermod_is_https;
8335b1
+static APR_OPTIONAL_FN_TYPE(ssl_var_lookup) *othermod_var_lookup;
8335b1
+
8335b1
 static int ssl_is_https(conn_rec *c)
8335b1
 {
8335b1
     SSLConnRec *sslconn = myConnConfig(c);
8335b1
-    return sslconn && sslconn->ssl;
8335b1
+    
8335b1
+    return (sslconn && sslconn->ssl)
8335b1
+        || (othermod_is_https && othermod_is_https(c));
8335b1
 }
8335b1
 
8335b1
 static const char var_interface[] = "mod_ssl/" AP_SERVER_BASEREVISION;
8335b1
@@ -106,6 +111,9 @@ void ssl_var_register(apr_pool_t *p)
8335b1
 {
8335b1
     char *cp, *cp2;
8335b1
 
8335b1
+    othermod_is_https = APR_RETRIEVE_OPTIONAL_FN(ssl_is_https);
8335b1
+    othermod_var_lookup = APR_RETRIEVE_OPTIONAL_FN(ssl_var_lookup);
8335b1
+
8335b1
     APR_REGISTER_OPTIONAL_FN(ssl_is_https);
8335b1
     APR_REGISTER_OPTIONAL_FN(ssl_var_lookup);
8335b1
     APR_REGISTER_OPTIONAL_FN(ssl_ext_list);
8335b1
@@ -241,6 +249,15 @@ char *ssl_var_lookup(apr_pool_t *p, serv
8335b1
      */
8335b1
     if (result == NULL && c != NULL) {
8335b1
         SSLConnRec *sslconn = myConnConfig(c);
8335b1
+
8335b1
+        if (strlen(var) > 4 && strcEQn(var, "SSL_", 4)
8335b1
+            && (!sslconn || !sslconn->ssl) && othermod_var_lookup) {
8335b1
+            /* For an SSL_* variable, if mod_ssl is not enabled for
8335b1
+             * this connection and another SSL module is present, pass
8335b1
+             * through to that module. */
8335b1
+            return othermod_var_lookup(p, s, c, r, var);
8335b1
+        }
8335b1
+
8335b1
         if (strlen(var) > 4 && strcEQn(var, "SSL_", 4)
8335b1
             && sslconn && sslconn->ssl)
8335b1
             result = ssl_var_lookup_ssl(p, c, r, var+4);