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/12/20 10:31:17 UTC

svn commit: r605846 - /tomcat/connectors/trunk/jk/native/common/jk_uri_worker_map.c

Author: rjung
Date: Thu Dec 20 01:31:16 2007
New Revision: 605846

URL: http://svn.apache.org/viewvc?rev=605846&view=rev
Log:
Fix uri worker mapping in case we use a vhost
prefix (at the moment only used by IIS).
We had a double leading '/', one coming from IIS
and another one added in jk_uri_worker_map.c.

Modified:
    tomcat/connectors/trunk/jk/native/common/jk_uri_worker_map.c

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?rev=605846&r1=605845&r2=605846&view=diff
==============================================================================
--- tomcat/connectors/trunk/jk/native/common/jk_uri_worker_map.c (original)
+++ tomcat/connectors/trunk/jk/native/common/jk_uri_worker_map.c Thu Dec 20 01:31:16 2007
@@ -631,19 +631,25 @@
  * vhost mapping rules especially for IIS.
  */
     if (vhost) {
+        int off = 0;
+/* Add leading '/' if necessary */
+        if (vhost[0] != '/') {
+            url[0] = '/';
+            off = 1;
+        }
 /* Size including leading slash. */
-        vhost_len = strlen(vhost) + 1;
-        if (vhost_len >= JK_MAX_URI_LEN) {
+        vhost_len = strlen(vhost);
+        if (vhost_len + off >= JK_MAX_URI_LEN) {
             vhost_len = 0;
             jk_log(l, JK_LOG_WARNING,
                    "Host prefix %s for URI %s is invalid and will be ignored."
                    " It must be smaller than %d chars",
-                   vhost, JK_MAX_URI_LEN-1);
+                   vhost, JK_MAX_URI_LEN - off);
         }
         else {
-            url[0] = '/';
-            strncpy(&url[1], vhost, vhost_len);
+            strncpy(&url[off], vhost, vhost_len + 1);
         }
+        vhost_len += off;
     }
     for (i = 0; i < strlen(uri); i++) {
         if (i == JK_MAX_URI_LEN) {



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