You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@apache.org on 2018/09/10 10:07:34 UTC

svn commit: r1840449 - /tomcat/jk/trunk/native/apache-2.0/mod_jk.c

Author: markt
Date: Mon Sep 10 10:07:34 2018
New Revision: 1840449

URL: http://svn.apache.org/viewvc?rev=1840449&view=rev
Log:
Optimize handling of request_config.

Modified:
    tomcat/jk/trunk/native/apache-2.0/mod_jk.c

Modified: tomcat/jk/trunk/native/apache-2.0/mod_jk.c
URL: http://svn.apache.org/viewvc/tomcat/jk/trunk/native/apache-2.0/mod_jk.c?rev=1840449&r1=1840448&r2=1840449&view=diff
==============================================================================
--- tomcat/jk/trunk/native/apache-2.0/mod_jk.c (original)
+++ tomcat/jk/trunk/native/apache-2.0/mod_jk.c Mon Sep 10 10:07:34 2018
@@ -2729,6 +2729,14 @@ static int jk_handler(request_rec * r)
         return DECLINED;
     }
 
+    rconf = (jk_request_conf_t *)ap_get_module_config(r->request_config, &jk_module);
+    if (rconf == NULL) {
+        rconf = apr_palloc(r->pool, sizeof(jk_request_conf_t));
+        rconf->jk_handled = JK_FALSE;
+        rconf->rule_extensions = NULL;
+        ap_set_module_config(r->request_config, &jk_module, rconf);
+    }
+
     worker_name = apr_table_get(r->notes, JK_NOTE_WORKER_NAME);
 
     if (worker_name == NULL) {
@@ -2752,8 +2760,6 @@ static int jk_handler(request_rec * r)
                 worker_name_extension = JK_TRUE;
                 parse_rule_extensions(w, e, xconf->log);
                 worker_name = w;
-                rconf = (jk_request_conf_t *)ap_get_module_config(r->request_config,
-                                                                  &jk_module);
                 rconf->rule_extensions = e;
             }
         }
@@ -2787,9 +2793,9 @@ static int jk_handler(request_rec * r)
 
                 worker_name = map_uri_to_worker_ext(xconf->uw_map, clean_uri,
                                                     NULL, &e, NULL, xconf->log);
-                rconf = (jk_request_conf_t *)ap_get_module_config(r->request_config,
-                                                                  &jk_module);
-                rconf->rule_extensions = e;
+                if (worker_name) {
+                    rconf->rule_extensions = e;
+                }
             }
 
             if (worker_name == NULL && worker_env.num_of_workers) {
@@ -2809,8 +2815,6 @@ static int jk_handler(request_rec * r)
               " r->proxyreq=%d",
               r->handler, STRNULL_FOR_NULL(worker_name), r->proxyreq);
 
-    rconf = (jk_request_conf_t *)ap_get_module_config(r->request_config,
-                                                      &jk_module);
     rconf->jk_handled = JK_TRUE;
 
     /* If this is a proxy request, we'll notify an error */
@@ -3845,8 +3849,9 @@ static int jk_translate(request_rec * r)
                 rule_extension_t *e;
                 worker = map_uri_to_worker_ext(conf->uw_map, clean_uri,
                                                NULL, &e, NULL, conf->log);
-                rconf->rule_extensions = e;
-                ap_set_module_config(r->request_config, &jk_module, rconf);
+                if (worker) {
+                    rconf->rule_extensions = e;
+                }
             }
 
             if (worker) {
@@ -4021,8 +4026,9 @@ static int jk_map_to_storage(request_rec
                 rule_extension_t *e;
                 worker = map_uri_to_worker_ext(conf->uw_map, clean_uri,
                                                NULL, &e, NULL, conf->log);
-                rconf->rule_extensions = e;
-                ap_set_module_config(r->request_config, &jk_module, rconf);
+                if (worker) {
+                    rconf->rule_extensions = e;
+                }
             }
 
             if (worker) {



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org