Bug 34474

Summary: Problem with "//" in url
Product: Tomcat 5 Reporter: Alessandro Iurlano <a.iurlano>
Component: Connector:AJPAssignee: Tomcat Developers Mailing List <dev>
Severity: normal    
Priority: P2    
Version: 5.0.28   
Target Milestone: ---   
Hardware: Other   
OS: Linux   

Description Alessandro Iurlano 2005-04-15 16:51:28 UTC
I had a webapp running on a tomcat 5.0.28 and visible through the ajp/1.3
connector via apache
This webapp generates urls to itself with // in them. When it is configured to
access the tomcat via the http connector it works correctly, but when it is
configured to operate via the ajp connector, the url is not reached.
I've noticed that this webapps works correctly on mod_jk 1.2.5.
I've had this problem on mod_jk 1.2.10
Having spent all the day to debug this problem, I think I've figured where it hides.
The code in mod_jk.c uses ap_no2slash(clean_uri) to remove double slashes in
jk_translate(). I think this happens registering workers base url to be fetched
later at the time to forward the uris.
Adding an ap_no2slash() in /jk/native/common/jk_uri_worker_map.c seems to fix
the problem. I don't know if this is right, because I've got almost no knowledge
of jk or apache internals. But now it seems to be working. Here is a patch:

--- jk_uri_worker_map.c.old     2005-04-15 14:49:10.000000000 +0000
+++ jk_uri_worker_map.c 2005-04-15 11:05:23.000000000 +0000
@@ -454,6 +454,10 @@
     if (JK_IS_DEBUG_LEVEL(l))
         jk_log(l, JK_LOG_DEBUG, "Attempting to map URI '%s' from %d maps",
                uri, uw_map->size);
+    ap_no2slash(uri);
+    if (JK_IS_DEBUG_LEVEL(l))
+        jk_log(l, JK_LOG_DEBUG, "Attempting to map URI '%s' from %d maps",
+               uri, uw_map->size);
     for (i = 0; i < uw_map->size; i++) {
         uri_worker_record_t *uwr = uw_map->maps[i];
Comment 1 Remy Maucherat 2005-04-15 17:06:42 UTC
*** Bug 34475 has been marked as a duplicate of this bug. ***
Comment 2 jfclere 2005-07-04 16:25:42 UTC
fixing jk_uri_worker_map.c is wrong, mod_jk.c in jk_translate() is the place to
fix the problem.