I tested yesterday's CVS head for compliance with session ID URL rewriting.
This fails. The jsessionid is lost from the URL.
Derrick
From: [EMAIL PROTECTED]
Reply-To: Tomcat Developers List tomcat-dev@jakarta.apache.org
To: [EMAIL PROTECTED]
Subject: cvs commit: jakarta-tomcat-connectors/jk/native/common
jk_uri_worker_map.c jk_uri_worker_map.h
Date: 16 Jun 2005 06:28:38 -
mturk 2005/06/15 23:28:38
Modified:jk/native/common jk_uri_worker_map.c jk_uri_worker_map.h
Log:
Do not modify the provided uri inplace, but rather use the stack buffer
for
that. Also change the map_uri_to_worker to be 'const char'.
Revision ChangesPath
1.56 +17 -12
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.55
retrieving revision 1.56
diff -u -r1.55 -r1.56
--- jk_uri_worker_map.c 18 May 2005 11:09:55 - 1.55
+++ jk_uri_worker_map.c 16 Jun 2005 06:28:38 - 1.56
@@ -411,12 +411,13 @@
const char *map_uri_to_worker(jk_uri_worker_map_t *uw_map,
- char *uri, jk_logger_t *l)
+ const char *uri, jk_logger_t *l)
{
unsigned int i;
char *url_rewrite;
-char rewrite_char = ';';
const char *rv = NULL;
+const char *url = uri;
+char buf[JK_MAX_URI_LEN+1];
JK_TRACE_ENTER(l);
if (!uw_map || !uri) {
@@ -432,10 +433,16 @@
}
url_rewrite = strstr(uri, JK_PATH_SESSION_IDENTIFIER);
if (url_rewrite) {
-rewrite_char = *url_rewrite;
-*url_rewrite = '\0';
+size_t len = url_rewrite - uri;
+if (len JK_MAX_URI_LEN)
+len = JK_MAX_URI_LEN;
+strncpy(buf, uri, len);
+buf[len] = '\0';
+url = buf[0];
+if (JK_IS_DEBUG_LEVEL(l))
+jk_log(l, JK_LOG_DEBUG, Removing Session path '%s' URI
'%s',
+ url_rewrite, url);
}
-
if (uw_map-fname)
uri_worker_map_update(uw_map, l);
if (JK_IS_DEBUG_LEVEL(l))
@@ -456,7 +463,7 @@
if (uwr-match_type MATCH_TYPE_WILDCHAR_PATH) {
const char *wname;
/* Map is already sorted by context_len */
-if (wildchar_match(uri, uwr-context,
+if (wildchar_match(url, uwr-context,
#ifdef WIN32
1
#else
@@ -473,8 +480,8 @@
goto cleanup;
}
}
-else if (JK_STRNCMP(uwr-context, uri, uwr-context_len) == 0)
{
-if (strlen(uri) == uwr-context_len) {
+else if (JK_STRNCMP(uwr-context, url, uwr-context_len) == 0)
{
+if (strlen(url) == uwr-context_len) {
if (JK_IS_DEBUG_LEVEL(l))
jk_log(l, JK_LOG_DEBUG,
Found an exact match %s - %s,
@@ -489,10 +496,8 @@
JK_TRACE_EXIT(l);
cleanup:
-if (url_rewrite)
-*url_rewrite = rewrite_char;
if (rv uw_map-nosize) {
-if (is_nomap_match(uw_map, uri, rv, l)) {
+if (is_nomap_match(uw_map, url, rv, l)) {
if (JK_IS_DEBUG_LEVEL(l))
jk_log(l, JK_LOG_DEBUG,
Denying matching for worker %s by nomatch
rule,
1.20 +3 -2
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.19
retrieving revision 1.20
diff -u -r1.19 -r1.20
--- jk_uri_worker_map.h 26 Apr 2005 15:28:18 - 1.19
+++ jk_uri_worker_map.h 16 Jun 2005 06:28:38 - 1.20
@@ -52,6 +52,7 @@
#define MATCH_TYPE_DISABLED 0x2000
#define MATCH_TYPE_STOPPED 0x4000
+#define JK_MAX_URI_LEN 4095
struct uri_worker_record
{
/* Original uri for logging */
@@ -113,7 +114,7 @@
const char *puri, const char *pworker,
jk_logger_t *l);
const char *map_uri_to_worker(jk_uri_worker_map_t *uw_map,
- char *uri, jk_logger_t *l);
+ const char *uri, jk_logger_t *l);
int uri_worker_map_load(jk_uri_worker_map_t *uw_map,
jk_logger_t *l);
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL