You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by mt...@apache.org on 2007/02/24 07:50:06 UTC

svn commit: r511227 - in /tomcat/connectors/trunk/jk: native/apache-1.3/mod_jk.c native/apache-2.0/mod_jk.c native/iis/jk_isapi_plugin.c xdocs/miscellaneous/changelog.xml xdocs/reference/apache.xml

Author: mturk
Date: Fri Feb 23 22:50:05 2007
New Revision: 511227

URL: http://svn.apache.org/viewvc?view=rev&rev=511227
Log:
Fix 41439 for Apache servers by adding JkStripSession directive.

Modified:
    tomcat/connectors/trunk/jk/native/apache-1.3/mod_jk.c
    tomcat/connectors/trunk/jk/native/apache-2.0/mod_jk.c
    tomcat/connectors/trunk/jk/native/iis/jk_isapi_plugin.c
    tomcat/connectors/trunk/jk/xdocs/miscellaneous/changelog.xml
    tomcat/connectors/trunk/jk/xdocs/reference/apache.xml

Modified: tomcat/connectors/trunk/jk/native/apache-1.3/mod_jk.c
URL: http://svn.apache.org/viewvc/tomcat/connectors/trunk/jk/native/apache-1.3/mod_jk.c?view=diff&rev=511227&r1=511226&r2=511227
==============================================================================
--- tomcat/connectors/trunk/jk/native/apache-1.3/mod_jk.c (original)
+++ tomcat/connectors/trunk/jk/native/apache-1.3/mod_jk.c Fri Feb 23 22:50:05 2007
@@ -174,6 +174,7 @@
     int options;
     int exclude_options;
 
+    int strip_session;
     /*
      * Environment variables support
      */
@@ -1118,6 +1119,25 @@
     return NULL;
 }
 
+/*
+ * JkStripSession directive handling
+ *
+ * JkStripSession On/Off
+ */
+
+static const char *jk_set_strip_session(cmd_parms * cmd, void *dummy, int flag)
+{
+    server_rec *s = cmd->server;
+    jk_server_conf_t *conf =
+        (jk_server_conf_t *) ap_get_module_config(s->module_config,
+                                                  &jk_module);
+
+    /* Set up our value */
+    conf->strip_session = flag ? JK_TRUE : JK_FALSE;
+
+    return NULL;
+}
+
 /*****************************************************************
  *
  * Actually logging.
@@ -1791,6 +1811,13 @@
      "Should the base server mounts be copied to the virtual server"},
 
     /*
+     * JkStripSession specifies if mod_jk should strip the ;jsessionid
+     * from the unmapperd urls
+     */
+    {"JkStripSession", jk_set_strip_session, NULL, RSRC_CONF, FLAG,
+     "Should the base server strip the jsessionid from the url"},
+
+    /*
      * JkLogFile & JkLogLevel specifies to where should the plugin log
      * its information and how much.
      * JkLogStampFormat specify the time-stamp to be used on log
@@ -2128,6 +2155,7 @@
         c->cipher_indicator = NULL;
         c->session_indicator = NULL;
         c->key_size_indicator = NULL;
+        c->strip_session = JK_UNSET;
     } else {
         c->mount_file_reload = JK_URIMAP_DEF_RELOAD;
         c->log_level = JK_LOG_DEF_LEVEL;
@@ -2147,6 +2175,7 @@
         c->cipher_indicator = JK_ENV_CIPHER;
         c->session_indicator = JK_ENV_SESSION;
         c->key_size_indicator = JK_ENV_KEY_SIZE;
+        c->strip_session = JK_FALSE;
     }
 
     if (!jk_map_alloc(&(c->uri_to_context))) {
@@ -2261,6 +2290,8 @@
         if (!overrides->alias_dir)
             overrides->alias_dir = base->alias_dir;
     }
+    if (overrides->strip_session == JK_UNSET)
+        overrides->strip_session = base->strip_session;
 
     return overrides;
 }
@@ -2671,6 +2702,16 @@
                             }
                         }
                     }
+                }
+            }
+            else if (conf->strip_session == JK_TRUE) {
+                char *jsessionid = strstr(r->uri, JK_PATH_SESSION_IDENTIFIER);
+                if (jsessionid) {
+                    if (JK_IS_DEBUG_LEVEL(conf->log))
+                        jk_log(conf->log, JK_LOG_DEBUG,
+                               "removing session identifier [%s] for non servlet url [%s]",
+                               jsessionid, r->uri);
+                    *jsessionid = '\0';
                 }
             }
         }

Modified: tomcat/connectors/trunk/jk/native/apache-2.0/mod_jk.c
URL: http://svn.apache.org/viewvc/tomcat/connectors/trunk/jk/native/apache-2.0/mod_jk.c?view=diff&rev=511227&r1=511226&r2=511227
==============================================================================
--- tomcat/connectors/trunk/jk/native/apache-2.0/mod_jk.c (original)
+++ tomcat/connectors/trunk/jk/native/apache-2.0/mod_jk.c Fri Feb 23 22:50:05 2007
@@ -211,6 +211,7 @@
     int options;
     int exclude_options;
 
+    int strip_session;
     /*
      * Environment variables support
      */
@@ -1142,6 +1143,25 @@
     return NULL;
 }
 
+/*
+ * JkStripSession directive handling
+ *
+ * JkStripSession On/Off
+ */
+
+static const char *jk_set_strip_session(cmd_parms * cmd, void *dummy, int flag)
+{
+    server_rec *s = cmd->server;
+    jk_server_conf_t *conf =
+        (jk_server_conf_t *) ap_get_module_config(s->module_config,
+                                                  &jk_module);
+
+    /* Set up our value */
+    conf->strip_session = flag ? JK_TRUE : JK_FALSE;
+
+    return NULL;
+}
+
 /*****************************************************************
  *
  * Actually logging.
@@ -1832,6 +1852,13 @@
                  "Should the base server mounts be copied to the virtual server"),
 
     /*
+     * JkStripSession specifies if mod_jk should strip the ;jsessionid
+     * from the unmapperd urls
+     */
+    AP_INIT_FLAG("JkStripSession", jk_set_strip_session, NULL, RSRC_CONF,
+                 "Should the base server strip the jsessionid from the url"),
+
+    /*
      * JkLogFile & JkLogLevel specifies to where should the plugin log
      * its information and how much.
      * JkLogStampFormat specify the time-stamp to be used on log
@@ -2254,6 +2281,7 @@
         c->cipher_indicator = NULL;
         c->session_indicator = NULL;
         c->key_size_indicator = NULL;
+        c->strip_session = JK_UNSET;
     } else {
         c->mount_file_reload = JK_URIMAP_DEF_RELOAD;
         c->log_level = JK_LOG_DEF_LEVEL;
@@ -2273,6 +2301,7 @@
         c->cipher_indicator = JK_ENV_CIPHER;
         c->session_indicator = JK_ENV_SESSION;
         c->key_size_indicator = JK_ENV_KEY_SIZE;
+        c->strip_session = JK_FALSE;
     }
 
     if (!jk_map_alloc(&(c->uri_to_context))) {
@@ -2393,6 +2422,8 @@
         if (!overrides->alias_dir)
             overrides->alias_dir = base->alias_dir;
     }
+    if (overrides->strip_session == JK_UNSET)
+        overrides->strip_session = base->strip_session;
 
     return overrides;
 }
@@ -2821,7 +2852,7 @@
             }
 
             worker = map_uri_to_worker(conf->uw_map, r->uri, conf->log);
- 
+
             if (worker) {
                 r->handler = apr_pstrdup(r->pool, JK_HANDLER);
                 apr_table_setn(r->notes, JK_NOTE_WORKER_NAME, worker);
@@ -2924,6 +2955,16 @@
                     }
                 }
             }
+            else if (conf->strip_session == JK_TRUE) {
+                char *jsessionid = strstr(r->uri, JK_PATH_SESSION_IDENTIFIER);
+                if (jsessionid) {
+                    if (JK_IS_DEBUG_LEVEL(conf->log))
+                        jk_log(conf->log, JK_LOG_DEBUG,
+                               "removing session identifier [%s] for non servlet url [%s]",
+                               jsessionid, r->uri);
+                    *jsessionid = '\0';
+                }
+            }
         }
     }
 
@@ -2972,6 +3013,16 @@
                 if (r->main)
                     apr_table_setn(r->main->notes, JK_NOTE_WORKER_NAME, worker);
 
+            }
+            else if (conf->strip_session == JK_TRUE) {
+                char *jsessionid = strstr(r->uri, JK_PATH_SESSION_IDENTIFIER);
+                if (jsessionid) {
+                    if (JK_IS_DEBUG_LEVEL(conf->log))
+                        jk_log(conf->log, JK_LOG_DEBUG,
+                               "removing session identifier [%s] for non servlet url [%s]",
+                               jsessionid, r->uri);
+                    *jsessionid = '\0';
+                }
             }
         }
     }

Modified: tomcat/connectors/trunk/jk/native/iis/jk_isapi_plugin.c
URL: http://svn.apache.org/viewvc/tomcat/connectors/trunk/jk/native/iis/jk_isapi_plugin.c?view=diff&rev=511227&r1=511226&r2=511227
==============================================================================
--- tomcat/connectors/trunk/jk/native/iis/jk_isapi_plugin.c (original)
+++ tomcat/connectors/trunk/jk/native/iis/jk_isapi_plugin.c Fri Feb 23 22:50:05 2007
@@ -528,13 +528,14 @@
         return JK_FALSE;
     }
 
-    if (s && s->ws_private) {
+    if (s && s->ws_private) {        
+        int rv = JK_TRUE;
         isapi_private_data_t *p = s->ws_private;
         if (!p->request_started) {
-            size_t len_of_status;
+            HSE_SEND_HEADER_EX_INFO hi;
             char *status_str;
-            char *headers_str;
-
+            char *headers_str = NULL;
+            BOOL keep_alive = FALSE;
             p->request_started = JK_TRUE;
 
             /*
@@ -543,9 +544,10 @@
             if (!reason) {
                 reason = status_reason(status);
             }
-            status_str = (char *)_alloca((6 + strlen(reason)) * sizeof(char));
+            status_str = (char *)malloc((6 + strlen(reason)));
             sprintf(status_str, "%d %s", status, reason);
-            len_of_status = strlen(status_str);
+            hi.pszStatus = status_str;
+            hi.cchStatus = strlen(status_str);
 
             /*
              * Create response headers string
@@ -555,11 +557,11 @@
                 for (i = 0, len_of_headers = 0; i < num_of_headers; i++) {
                     len_of_headers += strlen(header_names[i]);
                     len_of_headers += strlen(header_values[i]);
-                    len_of_headers += 4;        /* extra for colon, space and crlf */
+                    len_of_headers += 4;   /* extra for colon, space and crlf */
                 }
 
-                len_of_headers += 3;    /* crlf and terminating null char */
-                headers_str = (char *)_alloca(len_of_headers * sizeof(char));
+                len_of_headers += 3;       /* crlf and terminating null char */
+                headers_str = (char *)malloc(len_of_headers);
                 headers_str[0] = '\0';
 
                 for (i = 0; i < num_of_headers; i++) {
@@ -569,25 +571,29 @@
                     strcat(headers_str, crlf);
                 }
                 strcat(headers_str, crlf);
+                hi.pszHeader = headers_str;
+                hi.cchHeader = strlen(headers_str);
             }
             else {
-                headers_str = crlf;
+                hi.pszHeader = crlf;
+                hi.cchHeader = 2;
             }
-
+            hi.fKeepConn = keep_alive;            
             if (!p->lpEcb->ServerSupportFunction(p->lpEcb->ConnID,
-                                                 HSE_REQ_SEND_RESPONSE_HEADER,
-                                                 status_str,
-                                                 (LPDWORD) &len_of_status,
-                                                 (LPDWORD) headers_str)) {
+                                                 HSE_REQ_SEND_RESPONSE_HEADER_EX,
+                                                 &hi,
+                                                 NULL, NULL)) {
                 jk_log(logger, JK_LOG_ERROR,
-                       "HSE_REQ_SEND_RESPONSE_HEADER failed");
-                JK_TRACE_EXIT(logger);
-                return JK_FALSE;
+                       "HSE_REQ_SEND_RESPONSE_HEADER_EX failed");
+                rv = JK_FALSE;
             }
+            if (headers_str)
+                free(headers_str);
+            if (status_str)
+                free(status_str);
         }
         JK_TRACE_EXIT(logger);
-        return JK_TRUE;
-
+        return rv;
     }
 
     JK_LOG_NULL_PARAMS(logger);

Modified: tomcat/connectors/trunk/jk/xdocs/miscellaneous/changelog.xml
URL: http://svn.apache.org/viewvc/tomcat/connectors/trunk/jk/xdocs/miscellaneous/changelog.xml?view=diff&rev=511227&r1=511226&r2=511227
==============================================================================
--- tomcat/connectors/trunk/jk/xdocs/miscellaneous/changelog.xml (original)
+++ tomcat/connectors/trunk/jk/xdocs/miscellaneous/changelog.xml Fri Feb 23 22:50:05 2007
@@ -27,6 +27,11 @@
   <subsection name="Native">
     <changelog>
       <add>
+        <bug>41439</bug>: Allow session IDs to get stripped off URLs of static
+        content in Apache by adding JkStripSession
+        directive (configurable per vhost). (mturk)
+      </add>
+      <add>
       Change semantics of empty defaults for JkEnvVar variables.
       Until 1.2.19: not allowed. In 1.2.20: send variables as empty strings, if
       neither set to non empty in config, nor during runtime.

Modified: tomcat/connectors/trunk/jk/xdocs/reference/apache.xml
URL: http://svn.apache.org/viewvc/tomcat/connectors/trunk/jk/xdocs/reference/apache.xml?view=diff&rev=511227&r1=511226&r2=511227
==============================================================================
--- tomcat/connectors/trunk/jk/xdocs/reference/apache.xml (original)
+++ tomcat/connectors/trunk/jk/xdocs/reference/apache.xml Fri Feb 23 22:50:05 2007
@@ -220,7 +220,15 @@
 Not sending variables with empty defaults and empty runtime value
 has been introduced in version 1.2.21.
 </p></attribute>
-
+<attribute name="JkStripSession" required="false"><p>
+If this directive is set to On in some virtual server,
+the session IDs <code>;jsessionid=...</code> will be
+removed for non matched URLs.
+<br/>
+This directive is only allowed inside VirtualHost.
+<br/>
+The default is Off.
+</p></attribute>
 
 </attributes>
 </section>



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


Re: svn commit: r511227 - in /tomcat/connectors/trunk/jk: native/apache-1.3/mod_jk.c native/apache-2

Posted by Jean-Frederic <jf...@gmail.com>.
On Mon, 2007-02-26 at 16:07 +1300, Tim Whittington wrote:
> Never mind the second issue - one should read the docs more carefully. Apologies for the noise.
> The missing sizeof makes me nervous still.

sizeof(char) is one and there is a sprintf()...

Cheers

Jean-Frederic


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


Re: svn commit: r511227 - in /tomcat/connectors/trunk/jk: native/apache-1.3/mod_jk.c native/apache-2

Posted by Tim Whittington <Ti...@orionhealth.com>.
Never mind the second issue - one should read the docs more carefully. Apologies for the noise.
The missing sizeof makes me nervous still.
 
tim

>>> On 26/02/2007 at 2:33 p.m., in message <45...@orionhealth.com>, "Tim Whittington" <Ti...@orionhealth.com> wrote:
Mladen

Why was this changed to use malloc over _alloca here?

Regardless of that, it looks like there are two (potential) bugs introduced in this patch:
- There's no sizeof(char) in the mallo for status_str and headers_str
- status_str isn't initialised, so the check to free it will probably fire all the time and do nasty things if it's not allocated (we don't check malloc returns anyway, so it'll probably die before then when we write into the buffer).

Do you want me to BZ this?

tim

Modified: tomcat/connectors/trunk/jk/native/iis/jk_isapi_plugin.c
URL: http://svn.apache.org/viewvc/tomcat/connectors/trunk/jk/native/iis/jk_isapi_plugin.c?view=diff&rev=511227&r1=511226&r2=511227 
==============================================================================
--- tomcat/connectors/trunk/jk/native/iis/jk_isapi_plugin.c (original)
+++ tomcat/connectors/trunk/jk/native/iis/jk_isapi_plugin.c Fri Feb 23 22:50:05 2007
@@ -528,13 +528,14 @@
         return JK_FALSE;
     }

-    if (s && s->ws_private) {
+    if (s && s->ws_private) {        
+        int rv = JK_TRUE;
         isapi_private_data_t *p = s->ws_private;
         if (!p->request_started) {
-            size_t len_of_status;
+            HSE_SEND_HEADER_EX_INFO hi;
             char *status_str;
-            char *headers_str;
-
+            char *headers_str = NULL;
+            BOOL keep_alive = FALSE;
             p->request_started = JK_TRUE;

             /*
@@ -543,9 +544,10 @@
             if (!reason) {
                 reason = status_reason(status);
             }
-            status_str = (char *)_alloca((6 + strlen(reason)) * sizeof(char));
+            status_str = (char *)malloc((6 + strlen(reason)));
             sprintf(status_str, "%d %s", status, reason);
-            len_of_status = strlen(status_str);
+            hi.pszStatus = status_str;
+            hi.cchStatus = strlen(status_str);

             /*
              * Create response headers string
@@ -555,11 +557,11 @@
                 for (i = 0, len_of_headers = 0; i < num_of_headers; i++) {
                     len_of_headers += strlen(header_names[i]);
                     len_of_headers += strlen(header_values[i]);
-                    len_of_headers += 4;        /* extra for colon, space and crlf */
+                    len_of_headers += 4;   /* extra for colon, space and crlf */
                 }

-                len_of_headers += 3;    /* crlf and terminating null char */
-                headers_str = (char *)_alloca(len_of_headers * sizeof(char));
+                len_of_headers += 3;       /* crlf and terminating null char */
+                headers_str = (char *)malloc(len_of_headers);
                 headers_str[0] = '\0';

                 for (i = 0; i < num_of_headers; i++) {
@@ -569,25 +571,29 @@
                     strcat(headers_str, crlf);
                 }
                 strcat(headers_str, crlf);
+                hi.pszHeader = headers_str;
+                hi.cchHeader = strlen(headers_str);
             }
             else {
-                headers_str = crlf;
+                hi.pszHeader = crlf;
+                hi.cchHeader = 2;
             }
-
+            hi.fKeepConn = keep_alive;            
             if (!p->lpEcb->ServerSupportFunction(p->lpEcb->ConnID,
-                                                 HSE_REQ_SEND_RESPONSE_HEADER,
-                                                 status_str,
-                                                 (LPDWORD) &len_of_status,
-                                                 (LPDWORD) headers_str)) {
+                                                 HSE_REQ_SEND_RESPONSE_HEADER_EX,
+                                                 &hi,
+                                                 NULL, NULL)) {
                 jk_log(logger, JK_LOG_ERROR,
-                       "HSE_REQ_SEND_RESPONSE_HEADER failed");
-                JK_TRACE_EXIT(logger);
-                return JK_FALSE;
+                       "HSE_REQ_SEND_RESPONSE_HEADER_EX failed");
+                rv = JK_FALSE;
             }
+            if (headers_str)
+                free(headers_str);
+            if (status_str)
+                free(status_str);
         }
         JK_TRACE_EXIT(logger);
-        return JK_TRUE;
-
+        return rv;
     }

     JK_LOG_NULL_PARAMS(logger);

Modified: tomcat/connectors/trunk/jk/xdocs/miscellaneous/changelog.xml
URL: http://svn.apache.org/viewvc/tomcat/connectors/trunk/jk/xdocs/miscellaneous/changelog.xml?view=diff&rev=511227&r1=511226&r2=511227 
==============================================================================
--- tomcat/connectors/trunk/jk/xdocs/miscellaneous/changelog.xml (original)
+++ tomcat/connectors/trunk/jk/xdocs/miscellaneous/changelog.xml Fri Feb 23 22:50:05 2007
@@ -27,6 +27,11 @@
   <subsection name="Native">
     <changelog>
       <add>
+        <bug>41439</bug>: Allow session IDs to get stripped off URLs of static
+        content in Apache by adding JkStripSession
+        directive (configurable per vhost). (mturk)
+      </add>
+      <add>
       Change semantics of empty defaults for JkEnvVar variables.
       Until 1.2.19: not allowed. In 1.2.20: send variables as empty strings, if
       neither set to non empty in config, nor during runtime.

Modified: tomcat/connectors/trunk/jk/xdocs/reference/apache.xml
URL: http://svn.apache.org/viewvc/tomcat/connectors/trunk/jk/xdocs/reference/apache.xml?view=diff&rev=511227&r1=511226&r2=511227 
==============================================================================
--- tomcat/connectors/trunk/jk/xdocs/reference/apache.xml (original)
+++ tomcat/connectors/trunk/jk/xdocs/reference/apache.xml Fri Feb 23 22:50:05 2007
@@ -220,7 +220,15 @@
Not sending variables with empty defaults and empty runtime value
has been introduced in version 1.2.21.
</p></attribute>
-
+<attribute name="JkStripSession" required="false"><p>
+If this directive is set to On in some virtual server,
+the session IDs <code>;jsessionid=...</code> will be
+removed for non matched URLs.
+<br/>
+This directive is only allowed inside VirtualHost.
+<br/>
+The default is Off.
+</p></attribute>

</attributes>
</section>



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


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


______________________________________________________________________
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email 
______________________________________________________________________

Re: svn commit: r511227 - in /tomcat/connectors/trunk/jk: native/apache-1.3/mod_jk.c native/apache-2

Posted by Tim Whittington <Ti...@orionhealth.com>.
Mladen

Why was this changed to use malloc over _alloca here?

Regardless of that, it looks like there are two (potential) bugs introduced in this patch:
 - There's no sizeof(char) in the mallo for status_str and headers_str
 - status_str isn't initialised, so the check to free it will probably fire all the time and do nasty things if it's not allocated (we don't check malloc returns anyway, so it'll probably die before then when we write into the buffer).

Do you want me to BZ this?

tim

Modified: tomcat/connectors/trunk/jk/native/iis/jk_isapi_plugin.c
URL: http://svn.apache.org/viewvc/tomcat/connectors/trunk/jk/native/iis/jk_isapi_plugin.c?view=diff&rev=511227&r1=511226&r2=511227 
==============================================================================
--- tomcat/connectors/trunk/jk/native/iis/jk_isapi_plugin.c (original)
+++ tomcat/connectors/trunk/jk/native/iis/jk_isapi_plugin.c Fri Feb 23 22:50:05 2007
@@ -528,13 +528,14 @@
         return JK_FALSE;
     }

-    if (s && s->ws_private) {
+    if (s && s->ws_private) {        
+        int rv = JK_TRUE;
         isapi_private_data_t *p = s->ws_private;
         if (!p->request_started) {
-            size_t len_of_status;
+            HSE_SEND_HEADER_EX_INFO hi;
             char *status_str;
-            char *headers_str;
-
+            char *headers_str = NULL;
+            BOOL keep_alive = FALSE;
             p->request_started = JK_TRUE;

             /*
@@ -543,9 +544,10 @@
             if (!reason) {
                 reason = status_reason(status);
             }
-            status_str = (char *)_alloca((6 + strlen(reason)) * sizeof(char));
+            status_str = (char *)malloc((6 + strlen(reason)));
             sprintf(status_str, "%d %s", status, reason);
-            len_of_status = strlen(status_str);
+            hi.pszStatus = status_str;
+            hi.cchStatus = strlen(status_str);

             /*
              * Create response headers string
@@ -555,11 +557,11 @@
                 for (i = 0, len_of_headers = 0; i < num_of_headers; i++) {
                     len_of_headers += strlen(header_names[i]);
                     len_of_headers += strlen(header_values[i]);
-                    len_of_headers += 4;        /* extra for colon, space and crlf */
+                    len_of_headers += 4;   /* extra for colon, space and crlf */
                 }

-                len_of_headers += 3;    /* crlf and terminating null char */
-                headers_str = (char *)_alloca(len_of_headers * sizeof(char));
+                len_of_headers += 3;       /* crlf and terminating null char */
+                headers_str = (char *)malloc(len_of_headers);
                 headers_str[0] = '\0';

                 for (i = 0; i < num_of_headers; i++) {
@@ -569,25 +571,29 @@
                     strcat(headers_str, crlf);
                 }
                 strcat(headers_str, crlf);
+                hi.pszHeader = headers_str;
+                hi.cchHeader = strlen(headers_str);
             }
             else {
-                headers_str = crlf;
+                hi.pszHeader = crlf;
+                hi.cchHeader = 2;
             }
-
+            hi.fKeepConn = keep_alive;            
             if (!p->lpEcb->ServerSupportFunction(p->lpEcb->ConnID,
-                                                 HSE_REQ_SEND_RESPONSE_HEADER,
-                                                 status_str,
-                                                 (LPDWORD) &len_of_status,
-                                                 (LPDWORD) headers_str)) {
+                                                 HSE_REQ_SEND_RESPONSE_HEADER_EX,
+                                                 &hi,
+                                                 NULL, NULL)) {
                 jk_log(logger, JK_LOG_ERROR,
-                       "HSE_REQ_SEND_RESPONSE_HEADER failed");
-                JK_TRACE_EXIT(logger);
-                return JK_FALSE;
+                       "HSE_REQ_SEND_RESPONSE_HEADER_EX failed");
+                rv = JK_FALSE;
             }
+            if (headers_str)
+                free(headers_str);
+            if (status_str)
+                free(status_str);
         }
         JK_TRACE_EXIT(logger);
-        return JK_TRUE;
-
+        return rv;
     }

     JK_LOG_NULL_PARAMS(logger);

Modified: tomcat/connectors/trunk/jk/xdocs/miscellaneous/changelog.xml
URL: http://svn.apache.org/viewvc/tomcat/connectors/trunk/jk/xdocs/miscellaneous/changelog.xml?view=diff&rev=511227&r1=511226&r2=511227 
==============================================================================
--- tomcat/connectors/trunk/jk/xdocs/miscellaneous/changelog.xml (original)
+++ tomcat/connectors/trunk/jk/xdocs/miscellaneous/changelog.xml Fri Feb 23 22:50:05 2007
@@ -27,6 +27,11 @@
   <subsection name="Native">
     <changelog>
       <add>
+        <bug>41439</bug>: Allow session IDs to get stripped off URLs of static
+        content in Apache by adding JkStripSession
+        directive (configurable per vhost). (mturk)
+      </add>
+      <add>
       Change semantics of empty defaults for JkEnvVar variables.
       Until 1.2.19: not allowed. In 1.2.20: send variables as empty strings, if
       neither set to non empty in config, nor during runtime.

Modified: tomcat/connectors/trunk/jk/xdocs/reference/apache.xml
URL: http://svn.apache.org/viewvc/tomcat/connectors/trunk/jk/xdocs/reference/apache.xml?view=diff&rev=511227&r1=511226&r2=511227 
==============================================================================
--- tomcat/connectors/trunk/jk/xdocs/reference/apache.xml (original)
+++ tomcat/connectors/trunk/jk/xdocs/reference/apache.xml Fri Feb 23 22:50:05 2007
@@ -220,7 +220,15 @@
Not sending variables with empty defaults and empty runtime value
has been introduced in version 1.2.21.
</p></attribute>
-
+<attribute name="JkStripSession" required="false"><p>
+If this directive is set to On in some virtual server,
+the session IDs <code>;jsessionid=...</code> will be
+removed for non matched URLs.
+<br/>
+This directive is only allowed inside VirtualHost.
+<br/>
+The default is Off.
+</p></attribute>

</attributes>
</section>



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


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