*** common/jk_uri_worker_map.c 2003-09-06 11:37:21.000000000 -0400 --- common/jk_uri_worker_map.c.new 2004-04-08 14:23:10.000000000 -0400 *************** *** 80,85 **** --- 80,86 ---- #define MATCH_TYPE_GENERAL_SUFFIX (3) /* match all URIs of the form *ext */ /* match all context path URIs with a path component suffix */ #define MATCH_TYPE_CONTEXT_PATH (4) + #define MATCH_TYPE_JSESSIONID (5) struct uri_worker_record { /* Original uri for logging */ *************** *** 300,305 **** --- 301,317 ---- "Into jk_uri_worker_map_t::uri_worker_map_open, " "suffix rule %s.%s=%s was added\n", uri, asterisk + 3, worker); + } else if(0 == strncmp("/*" JK_PATH_SESSION_IDENTIFIER "*",asterisk,14) ) { + /* jsessionid rule */ + asterisk[1] = '\0'; + uwr->worker_name = worker; + uwr->context = uri; + uwr->suffix = "\0"; /* avoids some problems */ + uwr->match_type = MATCH_TYPE_JSESSIONID; + jk_log(l, JK_LOG_DEBUG, + "Into jk_uri_worker_map_t::uri_worker_map_open, " + "jsessionid rule %s*;jsessionid*=%s was added\n", + uri, worker); } else if ('\0' != asterisk[2]) { /* general suffix rule */ asterisk[1] = '\0'; *************** *** 478,483 **** --- 490,523 ---- *d = '\0'; } + uri_worker_record_t *check_jsessionid_matches(char *uri, + jk_uri_worker_map_t *uw_map, + jk_logger_t *l) + { + unsigned i; + uri_worker_record_t *match = NULL; + + for(i = 0 ; i < uw_map->size ; i++) { + uri_worker_record_t *uwr = uw_map->maps[i]; + + if(MATCH_TYPE_JSESSIONID == uwr->match_type) { + /* Check context match */ + + if(0 == strncmp(uwr->context, + uri, + uwr->ctxt_len)) { + /* Looks like a match: URI contains ";jsessionid", context matches */ + + jk_log(l, JK_LOG_DEBUG, "check_jsessionid_matches: Found context match: %s\n", uwr->context); + + match = uwr; + break; + } + } /* MATCH_TYPE_JSESSIONID */ + } /* foreach mapping */ + + return match; + } char *map_uri_to_worker(jk_uri_worker_map_t *uw_map, char *uri, *************** *** 493,498 **** --- 533,545 ---- char *url_rewrite = strstr(uri, JK_PATH_SESSION_IDENTIFIER); if(url_rewrite) { + uri_worker_record_t *match = check_jsessionid_matches(uri, uw_map, l); + if(NULL != match) { + jk_log(l, JK_LOG_DEBUG, "Mapped URI %s to context %s using jsessioni match\n", uri, match->context); + + return match->worker_name; + } + *url_rewrite = '\0'; } jk_no2slash(uri); *************** *** 559,564 **** --- 606,615 ---- } } } + } else if (MATCH_TYPE_JSESSIONID == uwr->match_type) { + + /* do nothing -- these have already been handled */ + } else /* suffix match */ { int suffix_start;