libapache2-mod-jk2 URI->scheme bug?

anoop aryal aaryal@foresightint.com
Fri Apr 30 22:14:01 2004


This is a multi-part message in MIME format.
--------------010007020101030302030103
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit

hi,
i had a virtual host setup with SSL on 443 (on apache. only ajp13 
without SSL connecter on tomcat4). it seems that mod_jk2 sets the port 
correctly but sets the scheme as http for requests of the form 
https://<someVHost>/<webapp>

it fell apart when the webapp tried to do a redirect with the Location 
header. it ended up sending "Location: http://<someVHost>:433/<webapp>"

which made apache complain about non-SSL request on the SSL port on the 
subsequent request from the browser.

i've submitted a bug. and i tried figuring out a fix. apxs2 wouldn't let 
me compile the module. (i had another module written from scratch that i 
could compile under redhat but couldn't compile under debian -- i've 
switched ;) ). are there problems with apxs2 too?

anyhow, the patch for what i think is going on is attached. i haven't 
even tried compiling (apxs2 wouldn't let me) it so it may be completely 
off base..

-- System Information:
Debian Release: testing/unstable
  APT prefers testing
  APT policy: (500, 'testing')
Architecture: i386 (i686)
Kernel: Linux 2.4.25-1-386
Locale: LANG=C, LC_CTYPE=C

Versions of packages libapache2-mod-jk2 depends on:
di  apache2-common              2.0.49-1     Next generation, scalable, extenda
ii  libc6                       2.3.2.ds1-11 GNU C Library: Shared libraries an




thanks,
anoop aryal
aaryal@foresightint.com


--------------010007020101030302030103
Content-Type: text/plain;
 name="mod_jk2.c.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename="mod_jk2.c.patch"

--- libapache2-mod-jk2-2.0.4/jk/native2/server/apache2/mod_jk2.c	2004-03-24 07:33:15.000000000 -0600
+++ ../mod_jk2.c	2004-04-30 23:01:06.000000000 -0500
@@ -205,13 +205,23 @@
          uriEnv->port != s->port)) {
         tmp_virtual = (char *)apr_pcalloc(cmd->pool,
                                           sizeof(char *) *
-                                          (strlen(s->server_hostname) + 8));
+                                          (strlen(s->server_hostname) + 16));
         tmp_full_url =
             (char *)apr_pcalloc(cmd->pool,
                                 sizeof(char *) * (strlen(s->server_hostname) +
-                                                  strlen(uriEnv->uri) + 8));
+                                                  strlen(uriEnv->uri) + 16));
         /* do not pass the hostname:0/ scheme */
-        if (s->port) {
+        /* 
+	   a better things to do would be to check and see if SSLEngine is on
+	   but for now, we'll hardcode by the port: 443->https, anything else
+	   is http by default.
+	*/
+	if(s->port == 443) {
+	  sprintf(tmp_virtual, "https://%s:%d", s->server_hostname, s->port);
+	  sprintf(tmp_full_url, "https://%s:%d%s", s->server_hostname, s->port,
+		  uriEnv->uri);
+	}
+	else if (s->port) {
             sprintf(tmp_virtual, "%s:%d", s->server_hostname, s->port);
             sprintf(tmp_full_url, "%s:%d%s", s->server_hostname, s->port,
                     uriEnv->uri);

--------------010007020101030302030103--