You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by rj...@apache.org on 2007/01/28 22:10:34 UTC
svn commit: r500880 - in /tomcat/connectors/trunk/jk: native/apache-1.3/
native/apache-2.0/ native/common/ native/iis/ native/netscape/
native/nt_service/ xdocs/miscellaneous/
Author: rjung
Date: Sun Jan 28 13:10:33 2007
New Revision: 500880
URL: http://svn.apache.org/viewvc?view=rev&rev=500880
Log:
- uriworkermap.properties: Fix off-by-one problem when deleting
URL mapping during reloading of uriworkermap.properties.
- A few fixes to map handling w.r.t duplicate entries:
- Add warning if duplicate map keys are read and are not allowed,
e.g. when parsing uriworkermap.properties.
- Don't concat worker names, if uriworkermap.properties has a duplicate
pattern, instead overwrite the worker.
- Log deprecation message even in duplication case.
Modified:
tomcat/connectors/trunk/jk/native/apache-1.3/mod_jk.c
tomcat/connectors/trunk/jk/native/apache-2.0/mod_jk.c
tomcat/connectors/trunk/jk/native/common/jk_map.c
tomcat/connectors/trunk/jk/native/common/jk_map.h
tomcat/connectors/trunk/jk/native/common/jk_uri_worker_map.c
tomcat/connectors/trunk/jk/native/iis/jk_isapi_plugin.c
tomcat/connectors/trunk/jk/native/netscape/jk_nsapi_plugin.c
tomcat/connectors/trunk/jk/native/nt_service/jk_nt_service.c
tomcat/connectors/trunk/jk/xdocs/miscellaneous/changelog.xml
Modified: tomcat/connectors/trunk/jk/native/apache-1.3/mod_jk.c
URL: http://svn.apache.org/viewvc/tomcat/connectors/trunk/jk/native/apache-1.3/mod_jk.c?view=diff&rev=500880&r1=500879&r2=500880
==============================================================================
--- tomcat/connectors/trunk/jk/native/apache-1.3/mod_jk.c (original)
+++ tomcat/connectors/trunk/jk/native/apache-1.3/mod_jk.c Sun Jan 28 13:10:33 2007
@@ -1704,7 +1704,7 @@
(jk_server_conf_t *) ap_get_module_config(s->module_config,
&jk_module);
- if (jk_map_read_property(conf->worker_properties, line, conf->log) == JK_FALSE)
+ if (jk_map_read_property(conf->worker_properties, line, 1, conf->log) == JK_FALSE)
return ap_pstrcat(cmd->temp_pool, "Invalid JkWorkerProperty ", line);
return NULL;
@@ -2445,7 +2445,7 @@
}
*/
- if (!jk_map_read_properties(init_map, conf->worker_file, NULL, conf->log)) {
+ if (!jk_map_read_properties(init_map, conf->worker_file, NULL, 1, conf->log)) {
if (jk_map_size(init_map) == 0) {
ap_log_error(APLOG_MARK, APLOG_EMERG, s,
Modified: tomcat/connectors/trunk/jk/native/apache-2.0/mod_jk.c
URL: http://svn.apache.org/viewvc/tomcat/connectors/trunk/jk/native/apache-2.0/mod_jk.c?view=diff&rev=500880&r1=500879&r2=500880
==============================================================================
--- tomcat/connectors/trunk/jk/native/apache-2.0/mod_jk.c (original)
+++ tomcat/connectors/trunk/jk/native/apache-2.0/mod_jk.c Sun Jan 28 13:10:33 2007
@@ -1739,7 +1739,7 @@
return err_string;
}
- if (jk_map_read_property(conf->worker_properties, line, conf->log) == JK_FALSE)
+ if (jk_map_read_property(conf->worker_properties, line, 1, conf->log) == JK_FALSE)
return apr_pstrcat(cmd->temp_pool, "Invalid JkWorkerProperty ", line);
return NULL;
@@ -2587,7 +2587,7 @@
jk_set_worker_def_cache_size(mpm_threads);
/* if(map_alloc(&init_map)) { */
- if (!jk_map_read_properties(init_map, conf->worker_file, NULL, conf->log)) {
+ if (!jk_map_read_properties(init_map, conf->worker_file, NULL, 1, conf->log)) {
if (jk_map_size(init_map) == 0) {
ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_CRIT,
0, NULL,
Modified: tomcat/connectors/trunk/jk/native/common/jk_map.c
URL: http://svn.apache.org/viewvc/tomcat/connectors/trunk/jk/native/common/jk_map.c?view=diff&rev=500880&r1=500879&r2=500880
==============================================================================
--- tomcat/connectors/trunk/jk/native/common/jk_map.c (original)
+++ tomcat/connectors/trunk/jk/native/common/jk_map.c Sun Jan 28 13:10:33 2007
@@ -346,7 +346,7 @@
return rc;
}
-int jk_map_read_property(jk_map_t *m, const char *str, jk_logger_t *l)
+int jk_map_read_property(jk_map_t *m, const char *str, int allow_duplicates, jk_logger_t *l)
{
int rc = JK_TRUE;
char buf[LENGTH_OF_LINE + 1];
@@ -365,29 +365,38 @@
trim(v);
if (strlen(v) && strlen(prp)) {
const char *oldv = jk_map_get_string(m, prp, NULL);
+ if (jk_is_deprecated_property(prp)) {
+ jk_log(l, JK_LOG_WARNING,
+ "The attribute '%s' is deprecated - please check"
+ " the documentation for the correct replacement.",
+ prp);
+ }
v = jk_map_replace_properties(m, v);
- if (oldv && jk_is_unique_property(prp) == JK_FALSE) {
- char *tmpv = jk_pool_alloc(&m->p,
- strlen(v) + strlen(oldv) + 3);
- if (tmpv) {
- char sep = '*';
- if (jk_is_path_property(prp))
- sep = PATH_SEPERATOR;
- else if (jk_is_cmd_line_property(prp))
- sep = ' ';
- else if (jk_is_list_property(prp))
- sep = ',';
- sprintf(tmpv, "%s%c%s", oldv, sep, v);
+ if (oldv) {
+ if (allow_duplicates && jk_is_unique_property(prp) == JK_FALSE) {
+ char *tmpv = jk_pool_alloc(&m->p,
+ strlen(v) + strlen(oldv) + 3);
+ if (tmpv) {
+ char sep = '*';
+ if (jk_is_path_property(prp))
+ sep = PATH_SEPERATOR;
+ else if (jk_is_cmd_line_property(prp))
+ sep = ' ';
+ else if (jk_is_list_property(prp))
+ sep = ',';
+ sprintf(tmpv, "%s%c%s", oldv, sep, v);
+ }
+ v = tmpv;
}
- v = tmpv;
- }
- else {
- if (jk_is_deprecated_property(prp)) {
+ else {
jk_log(l, JK_LOG_WARNING,
- "The attribute %s is deprecated - please check"
- " the documentation for the correct replacement.",
- prp);
+ "Duplicate key '%s' detected - previous value '%s'"
+ " will be overwritten with '%s'.",
+ prp, oldv ? oldv : "(null)", v ? v : "(null)");
+ v = jk_pool_strdup(&m->p, v);
}
+ }
+ else {
v = jk_pool_strdup(&m->p, v);
}
if (v) {
@@ -403,7 +412,7 @@
}
-int jk_map_read_properties(jk_map_t *m, const char *f, time_t *modified, jk_logger_t *l)
+int jk_map_read_properties(jk_map_t *m, const char *f, time_t *modified, int allow_duplicates, jk_logger_t *l)
{
int rc = JK_FALSE;
@@ -427,7 +436,7 @@
while (NULL != (prp = fgets(buf, LENGTH_OF_LINE, fp))) {
trim_prp_comment(prp);
if (*prp) {
- if ((rc = jk_map_read_property(m, prp, l)) == JK_FALSE)
+ if ((rc = jk_map_read_property(m, prp, allow_duplicates, l)) == JK_FALSE)
break;
}
}
Modified: tomcat/connectors/trunk/jk/native/common/jk_map.h
URL: http://svn.apache.org/viewvc/tomcat/connectors/trunk/jk/native/common/jk_map.h?view=diff&rev=500880&r1=500879&r2=500880
==============================================================================
--- tomcat/connectors/trunk/jk/native/common/jk_map.h (original)
+++ tomcat/connectors/trunk/jk/native/common/jk_map.h Sun Jan 28 13:10:33 2007
@@ -62,9 +62,9 @@
int jk_map_put(jk_map_t *m, const char *name, const void *value, void **old);
-int jk_map_read_property(jk_map_t *m, const char *str, jk_logger_t *l);
+int jk_map_read_property(jk_map_t *m, const char *str, int allow_duplicates, jk_logger_t *l);
-int jk_map_read_properties(jk_map_t *m, const char *f, time_t *modified, jk_logger_t *l);
+int jk_map_read_properties(jk_map_t *m, const char *f, time_t *modified, int allow_duplicates, jk_logger_t *l);
int jk_map_size(jk_map_t *m);
Modified: tomcat/connectors/trunk/jk/native/common/jk_uri_worker_map.c
URL: http://svn.apache.org/viewvc/tomcat/connectors/trunk/jk/native/common/jk_uri_worker_map.c?view=diff&rev=500880&r1=500879&r2=500880
==============================================================================
--- tomcat/connectors/trunk/jk/native/common/jk_uri_worker_map.c (original)
+++ tomcat/connectors/trunk/jk/native/common/jk_uri_worker_map.c Sun Jan 28 13:10:33 2007
@@ -285,7 +285,6 @@
JK_TRACE_ENTER(l);
- /* Find if duplicate entry */
for (i = 0; i < uw_map->size; i++) {
uwr = uw_map->maps[i];
if (uwr->source_type == source_type) {
@@ -295,6 +294,7 @@
for (j = i; j < uw_map->size-1; j++)
uw_map->maps[j] = uw_map->maps[j+1];
uw_map->size--;
+ i--;
}
}
@@ -643,7 +643,7 @@
jk_map_alloc(&map);
if (jk_map_read_properties(map, uw_map->fname,
- &uw_map->modified, l)) {
+ &uw_map->modified, 0, l)) {
int i;
if (JK_IS_DEBUG_LEVEL(l))
jk_log(l, JK_LOG_DEBUG,
Modified: tomcat/connectors/trunk/jk/native/iis/jk_isapi_plugin.c
URL: http://svn.apache.org/viewvc/tomcat/connectors/trunk/jk/native/iis/jk_isapi_plugin.c?view=diff&rev=500880&r1=500879&r2=500880
==============================================================================
--- tomcat/connectors/trunk/jk/native/iis/jk_isapi_plugin.c (original)
+++ tomcat/connectors/trunk/jk/native/iis/jk_isapi_plugin.c Sun Jan 28 13:10:33 2007
@@ -1265,7 +1265,7 @@
}
if (rewrite_rule_file[0] && jk_map_alloc(&rewrite_map)) {
- if (jk_map_read_properties(rewrite_map, rewrite_rule_file, NULL, logger)) {
+ if (jk_map_read_properties(rewrite_map, rewrite_rule_file, NULL, 1, logger)) {
if (JK_IS_DEBUG_LEVEL(logger)) {
jk_log(logger, JK_LOG_DEBUG, "Loaded rewrite rule file %s.",
rewrite_rule_file);
@@ -1288,7 +1288,7 @@
if (rc) {
rc = JK_FALSE;
if (jk_map_alloc(&workers_map)) {
- if (jk_map_read_properties(workers_map, worker_file, NULL, logger)) {
+ if (jk_map_read_properties(workers_map, worker_file, NULL, 1, logger)) {
/* we add the URI->WORKER MAP since workers using AJP14 will feed it */
if (jk_map_resolve_references(workers_map, "worker.", 1, 1, logger) == JK_FALSE) {
@@ -1351,7 +1351,7 @@
jk_map_t *map = NULL;
if (jk_map_alloc(&map)) {
- if (jk_map_read_properties(map, ini_file_name, NULL, logger)) {
+ if (jk_map_read_properties(map, ini_file_name, NULL, 1, logger)) {
using_ini_file = JK_TRUE;
src = map;
}
Modified: tomcat/connectors/trunk/jk/native/netscape/jk_nsapi_plugin.c
URL: http://svn.apache.org/viewvc/tomcat/connectors/trunk/jk/native/netscape/jk_nsapi_plugin.c?view=diff&rev=500880&r1=500879&r2=500880
==============================================================================
--- tomcat/connectors/trunk/jk/native/netscape/jk_nsapi_plugin.c (original)
+++ tomcat/connectors/trunk/jk/native/netscape/jk_nsapi_plugin.c Sun Jan 28 13:10:33 2007
@@ -246,7 +246,7 @@
jk_shm_open(shm_file, JK_SHM_DEF_SIZE, logger);
if (jk_map_alloc(&init_map)) {
- if (jk_map_read_properties(init_map, worker_prp_file, NULL, logger)) {
+ if (jk_map_read_properties(init_map, worker_prp_file, NULL, 1, logger)) {
int sleep_cnt;
SYS_THREAD s;
Modified: tomcat/connectors/trunk/jk/native/nt_service/jk_nt_service.c
URL: http://svn.apache.org/viewvc/tomcat/connectors/trunk/jk/native/nt_service/jk_nt_service.c?view=diff&rev=500880&r1=500879&r2=500880
==============================================================================
--- tomcat/connectors/trunk/jk/native/nt_service/jk_nt_service.c (original)
+++ tomcat/connectors/trunk/jk/native/nt_service/jk_nt_service.c Sun Jan 28 13:10:33 2007
@@ -956,7 +956,7 @@
jk_map_t *init_map;
if(jk_map_alloc(&init_map)) {
- if(jk_map_read_properties(init_map, prp_file, NULL, NULL)) {
+ if(jk_map_read_properties(init_map, prp_file, NULL, 1, NULL)) {
jk_tomcat_startup_data_t data;
jk_pool_t p;
jk_pool_atom_t buf[HUGE_POOL_SIZE];
Modified: tomcat/connectors/trunk/jk/xdocs/miscellaneous/changelog.xml
URL: http://svn.apache.org/viewvc/tomcat/connectors/trunk/jk/xdocs/miscellaneous/changelog.xml?view=diff&rev=500880&r1=500879&r2=500880
==============================================================================
--- tomcat/connectors/trunk/jk/xdocs/miscellaneous/changelog.xml (original)
+++ tomcat/connectors/trunk/jk/xdocs/miscellaneous/changelog.xml Sun Jan 28 13:10:33 2007
@@ -27,6 +27,21 @@
<subsection name="Native">
<changelog>
<add>
+ Add warning if duplicate map keys are read and are not allowed,
+ e.g. when parsing uriworkermap.properties. (rjung)
+ </add>
+ <fix>
+ Don't concat worker names, if uriworkermap.properties has a duplicate
+ pattern, instead overwrite the worker. (rjung)
+ </fix>
+ <fix>
+ Log deprecation message even in duplication case. (rjung)
+ </fix>
+ <fix>
+ uriworkermap.properties: Fix off-by-one problem when deleting
+ URL mapping during reloading of uriworkermap.properties. (rjung)
+ </fix>
+ <add>
<bug>41439</bug>: Allow session IDs to get stripped off URLs of static
content in IIS (configurable). (rjung)
</add>
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org