tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rj...@apache.org
Subject svn commit: r1647133 - in /tomcat/jk/trunk/native: apache-1.3/mod_jk.c apache-2.0/mod_jk.c
Date Sun, 21 Dec 2014 12:48:43 GMT
Author: rjung
Date: Sun Dec 21 12:48:42 2014
New Revision: 1647133

URL: http://svn.apache.org/r1647133
Log:
Fix Apache config handling for new JkOptions controlling
collapsing of adjacent slashes.

This is now tested and should work as documented.

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

Modified: tomcat/jk/trunk/native/apache-1.3/mod_jk.c
URL: http://svn.apache.org/viewvc/tomcat/jk/trunk/native/apache-1.3/mod_jk.c?rev=1647133&r1=1647132&r2=1647133&view=diff
==============================================================================
--- tomcat/jk/trunk/native/apache-1.3/mod_jk.c (original)
+++ tomcat/jk/trunk/native/apache-1.3/mod_jk.c Sun Dec 21 12:48:42 2014
@@ -2753,6 +2753,7 @@ static void *merge_jk_config(ap_pool * p
 {
     jk_server_conf_t *base = (jk_server_conf_t *) basev;
     jk_server_conf_t *overrides = (jk_server_conf_t *) overridesv;
+    int mask = 0;
 
     if (!overrides->log_file)
         overrides->log_file = base->log_file;
@@ -2797,16 +2798,13 @@ static void *merge_jk_config(ap_pool * p
     if (!overrides->key_size_indicator)
         overrides->key_size_indicator = base->key_size_indicator;
 
-/* Don't simply accumulate bits in the JK_OPT_FWDURIMASK region, */
-/* because those are multi-bit values. */
+/* Don't simply accumulate bits in the JK_OPT_FWDURIMASK or
+ * JK_OPT_COLLAPSEMASK region, because those are multi-bit values. */
     if (overrides->options & JK_OPT_FWDURIMASK)
-        overrides->options |= (base->options & ~base->exclude_options) &
~JK_OPT_FWDURIMASK;
-    else
-        overrides->options |= (base->options & ~base->exclude_options);
+        mask |= JK_OPT_FWDURIMASK;
     if (overrides->options & JK_OPT_COLLAPSEMASK)
-        overrides->options |= (base->options & ~base->exclude_options) &
~JK_OPT_COLLAPSEMASK;
-    else
-        overrides->options |= (base->options & ~base->exclude_options);
+        mask |= JK_OPT_COLLAPSEMASK;
+    overrides->options |= (base->options & ~base->exclude_options) & ~mask;
 
     if (base->envvars) {
         if (overrides->envvars && overrides->envvars_has_own) {
@@ -3005,7 +3003,6 @@ static void jk_init(server_rec * s, ap_p
             jk_server_conf_t *srvconf = (jk_server_conf_t *)create_jk_config(p, srv);
             sconf = (jk_server_conf_t *)merge_jk_config(p, sconf, srvconf);
             ap_set_module_config(srv->module_config, &jk_module, sconf);
-
         }
 
         if (sconf && sconf->was_initialized == JK_FALSE) {
@@ -3027,8 +3024,22 @@ static void jk_init(server_rec * s, ap_p
                     uri_worker_map_switch(sconf->uw_map, sconf->log);
                     uri_worker_map_load(sconf->uw_map, sconf->log);
                 }
-                if (conf->options & JK_OPT_COLLAPSEMASK)
-                    sconf->uw_map->collapse_slashes = conf->options & JK_OPT_COLLAPSEMASK;
+                switch (sconf->options & JK_OPT_COLLAPSEMASK) {
+                case JK_OPT_COLLAPSEALL:
+                    sconf->uw_map->collapse_slashes = JK_COLLAPSE_ALL;
+                    break;
+                case JK_OPT_COLLAPSENONE:
+                    sconf->uw_map->collapse_slashes = JK_COLLAPSE_NONE;
+                    break;
+                case JK_OPT_COLLAPSEUNMOUNT:
+                    sconf->uw_map->collapse_slashes = JK_COLLAPSE_UNMOUNT;
+                    break;
+                default:
+                    ap_log_error(APLOG_MARK, APLOG_WARNING, srv,
+                                 "Collapse slashes value %d ignored, setting to %d",
+                                 sconf->options & JK_OPT_COLLAPSEMASK, JK_COLLAPSE_DEFAULT);
+                    sconf->uw_map->collapse_slashes = JK_COLLAPSE_DEFAULT;
+                }
             }
             else {
                 if (sconf->mountcopy == JK_TRUE) {

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=1647133&r1=1647132&r2=1647133&view=diff
==============================================================================
--- tomcat/jk/trunk/native/apache-2.0/mod_jk.c (original)
+++ tomcat/jk/trunk/native/apache-2.0/mod_jk.c Sun Dec 21 12:48:42 2014
@@ -2988,6 +2988,7 @@ static void *merge_jk_config(apr_pool_t
 {
     jk_server_conf_t *base = (jk_server_conf_t *) basev;
     jk_server_conf_t *overrides = (jk_server_conf_t *) overridesv;
+    int mask = 0;
 
     if (!overrides->log_file)
         overrides->log_file = base->log_file;
@@ -3032,16 +3033,13 @@ static void *merge_jk_config(apr_pool_t
     if (!overrides->key_size_indicator)
         overrides->key_size_indicator = base->key_size_indicator;
 
-/* Don't simply accumulate bits in the JK_OPT_FWDURIMASK region, */
-/* because those are multi-bit values. */
+/* Don't simply accumulate bits in the JK_OPT_FWDURIMASK or
+ * JK_OPT_COLLAPSEMASK region, because those are multi-bit values. */
     if (overrides->options & JK_OPT_FWDURIMASK)
-        overrides->options |= (base->options & ~base->exclude_options) &
~JK_OPT_FWDURIMASK;
-    else
-        overrides->options |= (base->options & ~base->exclude_options);
+        mask |= JK_OPT_FWDURIMASK;
     if (overrides->options & JK_OPT_COLLAPSEMASK)
-        overrides->options |= (base->options & ~base->exclude_options) &
~JK_OPT_COLLAPSEMASK;
-    else
-        overrides->options |= (base->options & ~base->exclude_options);
+        mask |= JK_OPT_COLLAPSEMASK;
+    overrides->options |= (base->options & ~base->exclude_options) & ~mask;
 
     if (base->envvars) {
         if (overrides->envvars && overrides->envvars_has_own) {
@@ -3496,7 +3494,6 @@ static int jk_post_config(apr_pool_t * p
                     jk_server_conf_t *srvconf = (jk_server_conf_t *)create_jk_config(pconf,
srv);
                     sconf = (jk_server_conf_t *)merge_jk_config(pconf, sconf, srvconf);
                     ap_set_module_config(srv->module_config, &jk_module, sconf);
-
                 }
 
                 if (sconf && sconf->was_initialized == JK_FALSE) {
@@ -3519,8 +3516,22 @@ static int jk_post_config(apr_pool_t * p
                             uri_worker_map_switch(sconf->uw_map, sconf->log);
                             uri_worker_map_load(sconf->uw_map, sconf->log);
                         }
-                        if (conf->options & JK_OPT_COLLAPSEMASK)
-                            sconf->uw_map->collapse_slashes = conf->options &
JK_OPT_COLLAPSEMASK;
+                        switch (sconf->options & JK_OPT_COLLAPSEMASK) {
+                        case JK_OPT_COLLAPSEALL:
+                            sconf->uw_map->collapse_slashes = JK_COLLAPSE_ALL;
+                            break;
+                        case JK_OPT_COLLAPSENONE:
+                            sconf->uw_map->collapse_slashes = JK_COLLAPSE_NONE;
+                            break;
+                        case JK_OPT_COLLAPSEUNMOUNT:
+                            sconf->uw_map->collapse_slashes = JK_COLLAPSE_UNMOUNT;
+                            break;
+                        default:
+                            ap_log_error(APLOG_MARK, APLOG_WARNING, 0, s,
+                                         "Collapse slashes value %d ignored, setting to %d",
+                                         sconf->options & JK_OPT_COLLAPSEMASK, JK_COLLAPSE_DEFAULT);
+                            sconf->uw_map->collapse_slashes = JK_COLLAPSE_DEFAULT;
+                        }
                     }
                     else {
                         if (sconf->mountcopy == JK_TRUE) {



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


Mime
View raw message