tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lar...@apache.org
Subject cvs commit: jakarta-tomcat/src/native/mod_jk/iis jk_isapi_plugin.c
Date Sun, 02 Sep 2001 07:27:27 GMT
larryi      01/09/02 00:27:27

  Modified:    src/native/mod_jk/iis jk_isapi_plugin.c
  Log:
  Update to work with recent changes in Ajp13.java.  The absence of
  a content-length header is interpreted to mean an unknown, but non-zero
  length. For a zero length body, a content-length header saying so is now
  required.
  
  The init_ws_service() method now adds a content-length header if not
  present and the length is zero.
  
  Revision  Changes    Path
  1.3       +18 -3     jakarta-tomcat/src/native/mod_jk/iis/jk_isapi_plugin.c
  
  Index: jk_isapi_plugin.c
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/native/mod_jk/iis/jk_isapi_plugin.c,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- jk_isapi_plugin.c	2000/12/11 21:17:47	1.2
  +++ jk_isapi_plugin.c	2001/09/02 07:27:27	1.3
  @@ -56,7 +56,7 @@
   /***************************************************************************
    * Description: ISAPI plugin for IIS/PWS                                   *
    * Author:      Gal Shachor <shachor@il.ibm.com>                           *
  - * Version:     $Revision: 1.2 $                                               *
  + * Version:     $Revision: 1.3 $                                               *
    ***************************************************************************/
   
   #include <httpext.h>
  @@ -84,6 +84,7 @@
    */
   #define URI_HEADER_NAME         ("TOMCATURI:")
   #define WORKER_HEADER_NAME      ("TOMCATWORKER:")
  +#define CONTENT_LENGTH          ("CONTENT_LENGTH:")
   
   #define HTTP_URI_HEADER_NAME     ("HTTP_TOMCATURI")
   #define HTTP_WORKER_HEADER_NAME  ("HTTP_TOMCATWORKER")
  @@ -872,10 +873,12 @@
               char *headers_buf = jk_pool_strdup(&private_data->p, huge_buf);
               unsigned i;
               unsigned len_of_http_prefix = strlen("HTTP_");
  +            BOOL need_content_length_header = (s->content_length == 0);
               
               cnt -= 2; /* For our two special headers */
  -            s->headers_names  = jk_pool_alloc(&private_data->p, cnt * sizeof(char
*));
  -            s->headers_values = jk_pool_alloc(&private_data->p, cnt * sizeof(char
*));
  +            /* allocate an extra header slot in case we need to add a content-length header
*/
  +            s->headers_names  = jk_pool_alloc(&private_data->p, (cnt + 1) * sizeof(char
*));
  +            s->headers_values = jk_pool_alloc(&private_data->p, (cnt + 1) * sizeof(char
*));
   
               if(!s->headers_names || !s->headers_values || !headers_buf) {
                   return JK_FALSE;
  @@ -890,6 +893,9 @@
                   if(!strnicmp(tmp, URI_HEADER_NAME, strlen(URI_HEADER_NAME)) ||
                      !strnicmp(tmp, WORKER_HEADER_NAME, strlen(WORKER_HEADER_NAME))) {
                       real_header = JK_FALSE;
  +                } else if(need_content_length_header &&
  +                   !strnicmp(tmp, CONTENT_LENGTH, strlen(CONTENT_LENGTH))) {
  +                    need_content_length_header = FALSE;
                   } else {
                       s->headers_names[i]  = tmp;
                   }
  @@ -928,6 +934,15 @@
                   if(real_header) {
                       i++;
                   }
  +            }
  +            /* Add a content-length = 0 header if needed.
  +             * Ajp13 assumes an absent content-length header means an unknown,
  +             * but non-zero length body.
  +             */
  +            if(need_content_length_header) {
  +                s->headers_names[cnt] = "content-length";
  +                s->headers_values[cnt] = "0";
  +                cnt++;
               }
               s->num_headers = cnt;
           } else {
  
  
  

Mime
View raw message