hgomez 01/10/01 14:27:29
Modified: src/native/mod_jk/apache1.3 mod_jk.c
src/native/mod_jk/common jk_global.h
Log:
Updated code to handle getRequestURI()
with compatibility mode for old TC and
new schema (by default) for TC 3.3
Revision Changes Path
1.20 +70 -5 jakarta-tomcat/src/native/mod_jk/apache1.3/mod_jk.c
Index: mod_jk.c
===================================================================
RCS file: /home/cvs/jakarta-tomcat/src/native/mod_jk/apache1.3/mod_jk.c,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -r1.19 -r1.20
--- mod_jk.c 2001/09/28 09:55:14 1.19
+++ mod_jk.c 2001/10/01 21:27:29 1.20
@@ -443,9 +443,42 @@
* HttpServletRequest.getRequestURI() should remain encoded.
* [http://java.sun.com/products/servlet/errata_042700.html]
*
+ * We use JkOptions to determine which method to be used
+ *
+ * ap_escape_uri is the latest recommanded but require
+ * some java decoding (in TC 3.3 rc2)
+ *
+ * unparsed_uri is used for strict compliance with spec and
+ * old Tomcat (3.2.3 for example)
+ *
+ * uri is use for compatibilty with mod_rewrite with old Tomcats
*/
- s->req_uri = ap_escape_uri(r->pool, r->uri);
+ switch (conf->options & JK_OPT_FWDURIMASK) {
+
+ case JK_OPT_FWDURICOMPATUNPARSED :
+ s->req_uri = r->unparsed_uri;
+ if (s->req_uri != NULL) {
+ char *query_str = strchr(s->req_uri, '?');
+ if (query_str != NULL) {
+ *query_str = 0;
+ }
+ }
+
+ break;
+
+ case JK_OPT_FWDURICOMPAT :
+ s->req_uri = r->uri;
+ break;
+
+ case JK_OPT_FWDURIESCAPED :
+ s->req_uri = ap_escape_uri(r->pool, r->uri);
+ break;
+
+ default :
+ return JK_FALSE;
+ }
+
s->is_ssl = JK_FALSE;
s->ssl_cert = NULL;
s->ssl_cert_len = 0;
@@ -735,11 +768,23 @@
}
+/*
+ * JkOptions Directive Handling
+ *
+ *
+ * +ForwardSSLKeySize => Forward SSL Key Size, to follow 2.3 specs but may
broke old TC 3.2
+ * -ForwardSSLKeySize => Don't Forward SSL Key Size, will make mod_jk works
with all TC release
+ * ForwardURICompat => Forward URI normally, less spec compliant but
mod_rewrite compatible (old TC)
+ * ForwardURICompatUnparsed => Forward URI as unparsed, spec compliant but broke
mod_rewrite (old TC)
+ * ForwardURIEscaped => Forward URI escaped and Tomcat (3.3 rc2) stuff will
do the decoding part
+ */
+
const char *jk_set_options(cmd_parms *cmd,
void *dummy,
const char *line)
{
int opt = 0;
+ int mask = 0;
char action;
char *w;
@@ -754,12 +799,29 @@
if (*w == '+' || *w == '-') {
action = *(w++);
}
+
+ mask = 0;
- if (!strcasecmp(w, "ForwardKeySize"))
+ if (!strcasecmp(w, "ForwardKeySize")) {
opt = JK_OPT_FWDKEYSIZE;
+ }
+ else if (!strcasecmp(w, "ForwardURICompat")) {
+ opt = JK_OPT_FWDURICOMPAT;
+ mask = JK_OPT_FWDURIMASK;
+ }
+ else if (!strcasecmp(w, "ForwardURICompatUnparsed")) {
+ opt = JK_OPT_FWDURICOMPATUNPARSED;
+ mask = JK_OPT_FWDURIMASK;
+ }
+ else if (!strcasecmp(w, "ForwardURIEscaped")) {
+ opt = JK_OPT_FWDURIESCAPED;
+ mask = JK_OPT_FWDURIMASK;
+ }
else
return ap_pstrcat(cmd->pool, "JkOptions: Illegal option '", w, "'",
NULL);
+ conf->options &= ~mask;
+
if (action == '-') {
conf->options &= ~opt;
}
@@ -858,8 +920,11 @@
/*
* Options to tune mod_jk configuration
* for now we understand :
- * +ForwardSSLKeySize => Forward SSL Key Size, to follow 2.3 specs but may
broke old TC 3.2
- * -ForwardSSLKeySize => Don't Forward SSL Key Size, will make mod_jk works
with all TC release
+ * +ForwardSSLKeySize => Forward SSL Key Size, to follow 2.3 specs but
may broke old TC 3.2
+ * -ForwardSSLKeySize => Don't Forward SSL Key Size, will make mod_jk
works with all TC release
+ * ForwardURICompat => Forward URI normally, less spec compliant but
mod_rewrite compatible (old TC)
+ * ForwardURICompatUnparsed => Forward URI as unparsed, spec compliant but
broke mod_rewrite (old TC)
+ * ForwardURIEscaped => Forward URI escaped and Tomcat (3.3 rc2) stuff
will do the decoding part
*/
{"JkOptions", jk_set_options, NULL, RSRC_CONF, RAW_ARGS,
"Set one of more options to configure the mod_jk module"},
@@ -970,7 +1035,7 @@
/*
* No options by default
*/
- c->options = 0;
+ c->options = JK_OPT_FWDURIDEFAULT;
/*
* By default we will try to gather SSL info.
1.7 +10 -2 jakarta-tomcat/src/native/mod_jk/common/jk_global.h
Index: jk_global.h
===================================================================
RCS file: /home/cvs/jakarta-tomcat/src/native/mod_jk/common/jk_global.h,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- jk_global.h 2001/09/28 09:55:14 1.6
+++ jk_global.h 2001/10/01 21:27:29 1.7
@@ -57,7 +57,7 @@
* Description: Global definitions and include files that should exist *
* anywhere *
* Author: Gal Shachor <[EMAIL PROTECTED]> *
- * Version: $Revision: 1.6 $ *
+ * Version: $Revision: 1.7 $ *
***************************************************************************/
#ifndef JK_GLOBAL_H
@@ -151,7 +151,15 @@
* JK options
*/
-#define JK_OPT_FWDKEYSIZE 0x0002
+#define JK_OPT_FWDURIMASK 0x0003
+
+#define JK_OPT_FWDURICOMPAT 0x0001
+#define JK_OPT_FWDURICOMPATUNPARSED 0x0002
+#define JK_OPT_FWDURIESCAPED 0x0003
+
+#define JK_OPT_FWDURIDEFAULT JK_OPT_FWDURIESCAPED
+
+#define JK_OPT_FWDKEYSIZE 0x0004
#ifdef __cplusplus
}