billbarker 2003/06/30 22:16:47 Modified: jk/native/apache-1.3 Tag: coyote_10 mod_jk.c jk/native/apache-2.0 Tag: coyote_10 mod_jk.c jk/native/common Tag: coyote_10 jk_uri_worker_map.c jk_uri_worker_map.h Log: Port patch for "//" from HEAD branch. Revision Changes Path No revision No revision 1.35.2.1 +6 -4 jakarta-tomcat-connectors/jk/native/apache-1.3/mod_jk.c Index: mod_jk.c =================================================================== RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native/apache-1.3/mod_jk.c,v retrieving revision 1.35 retrieving revision 1.35.2.1 diff -u -r1.35 -r1.35.2.1 --- mod_jk.c 7 Jan 2003 01:27:11 -0000 1.35 +++ mod_jk.c 1 Jul 2003 05:16:46 -0000 1.35.2.1 @@ -1842,15 +1842,17 @@ r->handler = ap_pstrdup(r->pool, JK_HANDLER); ap_table_setn(r->notes, JK_WORKER_ID, worker); } else if(conf->alias_dir != NULL) { + char *clean_uri = ap_pstrdup(r->pool, r->uri); + ap_no2slash(clean_uri); /* Automatically map uri to a context static file */ jk_log(l, JK_LOG_DEBUG, "mod_jk::jk_translate, check alias_dir: %s\n",conf->alias_dir); - if (strlen(r->uri) > 1) { + if (strlen(clean_uri) > 1) { /* Get the context directory name */ char *context_dir = NULL; char *context_path = NULL; char *child_dir = NULL; - char *index = r->uri; + char *index = clean_uri; char *suffix = strchr(index+1,'/'); if( suffix != NULL ) { int size = suffix - index; @@ -1887,7 +1889,7 @@ if( context_path != NULL ) { DIR *dir = ap_popendir(r->pool,context_path); if( dir != NULL ) { - char *escurl = ap_os_escape_path(r->pool, r->uri, 1); + char *escurl = ap_os_escape_path(r->pool, clean_uri, 1); char *ret = ap_pstrcat(r->pool,conf->alias_dir,escurl,NULL); ap_pclosedir(r->pool,dir); /* Add code to verify real path ap_os_canonical_name */ No revision No revision 1.65.2.1 +6 -4 jakarta-tomcat-connectors/jk/native/apache-2.0/mod_jk.c Index: mod_jk.c =================================================================== RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native/apache-2.0/mod_jk.c,v retrieving revision 1.65 retrieving revision 1.65.2.1 diff -u -r1.65 -r1.65.2.1 --- mod_jk.c 7 Jan 2003 01:27:11 -0000 1.65 +++ mod_jk.c 1 Jul 2003 05:16:47 -0000 1.65.2.1 @@ -2134,16 +2134,18 @@ return OK; } else if(conf->alias_dir != NULL) { + char *clean_uri = ap_pstrdup(r->pool, r->uri); + ap_no2slash(clean_uri); /* Automatically map uri to a context static file */ jk_log(conf->log, JK_LOG_DEBUG, "mod_jk::jk_translate, check alias_dir: %s\n", conf->alias_dir); - if (strlen(r->uri) > 1) { + if (strlen(clean_uri) > 1) { /* Get the context directory name */ char *context_dir = NULL; char *context_path = NULL; char *child_dir = NULL; - char *index = r->uri; + char *index = clean_uri; char *suffix = strchr(index+1,'/'); if( suffix != NULL ) { int size = suffix - index; @@ -2181,7 +2183,7 @@ finfo.filetype = APR_NOFILE; apr_stat(&finfo,context_path,APR_FINFO_TYPE,r->pool); if( finfo.filetype == APR_DIR ) { - char *escurl = ap_os_escape_path(r->pool, r->uri, 1); + char *escurl = ap_os_escape_path(r->pool, clean_uri, 1); char *ret = ap_pstrcat(r->pool,conf->alias_dir,escurl,NULL); /* Add code to verify real path ap_os_canonical_name */ if( ret != NULL ) { No revision No revision 1.14.2.1 +31 -7 jakarta-tomcat-connectors/jk/native/common/jk_uri_worker_map.c Index: jk_uri_worker_map.c =================================================================== RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native/common/jk_uri_worker_map.c,v retrieving revision 1.14 retrieving revision 1.14.2.1 diff -u -r1.14 -r1.14.2.1 --- jk_uri_worker_map.c 21 Apr 2002 22:57:11 -0000 1.14 +++ jk_uri_worker_map.c 1 Jul 2003 05:16:47 -0000 1.14.2.1 @@ -453,6 +453,31 @@ return JK_FALSE; } +void jk_no2slash(char *name) +{ + char *d, *s; + + s = d = name; + +#if defined(HAVE_UNC_PATHS) + /* Check for UNC names. Leave leading two slashes. */ + if (s[0] == '/' && s[1] == '/') + *d++ = *s++; +#endif + + while (*s) { + if ((*d++ = *s) == '/') { + do { + ++s; + } while (*s == '/'); + } + else { + ++s; + } + } + *d = '\0'; +} + char *map_uri_to_worker(jk_uri_worker_map_t *uw_map, const char *uri, jk_logger_t *l) @@ -464,17 +489,16 @@ unsigned i; unsigned best_match = -1; unsigned longest_match = 0; - char * clean_uri = NULL; - char *url_rewrite = strstr(uri, JK_PATH_SESSION_IDENTIFIER); + char * clean_uri = jk_pool_strdup(&uw_map->tp,uri);; + char *url_rewrite = strstr(clean_uri, JK_PATH_SESSION_IDENTIFIER); if(url_rewrite) { - clean_uri = jk_pool_strdup(&uw_map->tp,uri); - url_rewrite = strstr(clean_uri, JK_PATH_SESSION_IDENTIFIER); *url_rewrite = '\0'; - uri = clean_uri; } + jk_no2slash(clean_uri); + uri = clean_uri; - jk_log(l, JK_LOG_DEBUG, "Attempting to map URI '%s'\n", uri); + jk_log(l, JK_LOG_DEBUG, "Attempting to map URI '%s'\n", uri); for(i = 0 ; i < uw_map->size ; i++) { uri_worker_record_t *uwr = uw_map->maps[i]; 1.5.2.1 +3 -1 jakarta-tomcat-connectors/jk/native/common/jk_uri_worker_map.h Index: jk_uri_worker_map.h =================================================================== RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native/common/jk_uri_worker_map.h,v retrieving revision 1.5 retrieving revision 1.5.2.1 diff -u -r1.5 -r1.5.2.1 --- jk_uri_worker_map.h 4 Dec 2001 19:44:23 -0000 1.5 +++ jk_uri_worker_map.h 1 Jul 2003 05:16:47 -0000 1.5.2.1 @@ -95,6 +95,8 @@ int uri_worker_map_close(jk_uri_worker_map_t *uw_map, jk_logger_t *l); +void jk_no2slash(char *name); + char *map_uri_to_worker(jk_uri_worker_map_t *uw_map, const char *uri, jk_logger_t *l);
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]