tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mt...@apache.org
Subject cvs commit: jakarta-tomcat-connectors/jk/native/iis jk_isapi_plugin.c
Date Fri, 08 Oct 2004 10:37:12 GMT
mturk       2004/10/08 03:37:12

  Modified:    jk/native/iis jk_isapi_plugin.c
  Log:
  Remove computing properties file on each dll event.
  Fix reporting error page to client, and few compile time warnigs.
  
  Revision  Changes    Path
  1.25      +43 -38    jakarta-tomcat-connectors/jk/native/iis/jk_isapi_plugin.c
  
  Index: jk_isapi_plugin.c
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native/iis/jk_isapi_plugin.c,v
  retrieving revision 1.24
  retrieving revision 1.25
  diff -u -r1.24 -r1.25
  --- jk_isapi_plugin.c	8 Oct 2004 08:55:13 -0000	1.24
  +++ jk_isapi_plugin.c	8 Oct 2004 10:37:12 -0000	1.25
  @@ -71,6 +71,7 @@
   #define BAD_PATH        -2
   #define MAX_SERVERNAME  128
   
  +#define JK_TOLOWER(x)   ((char)tolower((unsigned char)(x)))
   
   #define GET_SERVER_VARIABLE_VALUE(name, place)          \
     do {                                                  \
  @@ -128,7 +129,8 @@
   
   static jk_worker_env_t worker_env;
   
  -struct isapi_private_data
  +typedef struct isapi_private_data_t isapi_private_data_t;
  +struct isapi_private_data_t
   {
       jk_pool_t p;
   
  @@ -136,7 +138,6 @@
       unsigned bytes_read_so_far;
       LPEXTENSION_CONTROL_BLOCK lpEcb;
   };
  -typedef struct isapi_private_data isapi_private_data_t;
   
   
   static int JK_METHOD start_response(jk_ws_service_t *s,
  @@ -171,7 +172,7 @@
   static int base64_encode_cert_len(int len);
   
   static int base64_encode_cert(char *encoded,
  -                              const unsigned char *string, int len);
  +                              const char *string, int len);
   
   
   static char x2c(const char *what)
  @@ -256,8 +257,10 @@
               else
                   l = 0;
               n = l;
  -            while ((name[n] = name[m]))
  -                (++n, ++m);
  +            while ((name[n] = name[m])) {
  +                n++;
  +                m++;
  +            }
           }
           else
               ++l;
  @@ -319,20 +322,19 @@
   {
       const unsigned char *s = (const unsigned char *)path;
       unsigned char *d = (unsigned char *)dest;
  -    unsigned char *e = dest + destsize - 1;
  -    unsigned char *ee = dest + destsize - 3;
  -    unsigned c;
  +    unsigned char *e = d + destsize - 1;
  +    unsigned char *ee = d + destsize - 3;
   
  -    while ((c = *s)) {
  -        if (TEST_CHAR(c, T_OS_ESCAPE_PATH)) {
  +    while (*s) {
  +        if (TEST_CHAR(*s, T_OS_ESCAPE_PATH)) {
               if (d >= ee)
                   return JK_FALSE;
  -            d = c2x(c, d);
  +            d = c2x(*s, d);
           }
           else {
               if (d >= e)
                   return JK_FALSE;
  -            *d++ = c;
  +            *d++ = *s;
           }
           ++s;
       }
  @@ -344,7 +346,7 @@
   {
       char *c = uri;
       while (*c) {
  -        *c = tolower(*c);
  +        *c = JK_TOLOWER(*c);
           c++;
       }
       if (strstr(uri, "web-inf")) {
  @@ -360,17 +362,16 @@
   static void write_error_response(PHTTP_FILTER_CONTEXT pfc, char *status,
                                    char *msg)
   {
  -    char crlf[3] = { (char)13, (char)10, '\0' };
       char ctype[30];
  -    DWORD len = strlen(msg);
  +    size_t len = strlen(msg);
   
  -    sprintf(ctype, "Content-Type:text/html%s%s", crlf, crlf);
  +    strcpy(ctype, "Content-Type:text/html\r\n\r\n");
   
       /* reject !!! */
       pfc->ServerSupportFunction(pfc,
                                  SF_REQ_SEND_RESPONSE_HEADER,
  -                               status, (DWORD) crlf, (DWORD) ctype);
  -    pfc->WriteClient(pfc, msg, &len, 0);
  +                               status, (DWORD) &ctype[0], 0);
  +    pfc->WriteClient(pfc, msg, (LPDWORD)&len, 0);
   }
   
   
  @@ -395,7 +396,7 @@
       if (s && s->ws_private) {
           isapi_private_data_t *p = s->ws_private;
           if (!p->request_started) {
  -            DWORD len_of_status;
  +            size_t len_of_status;
               char *status_str;
               char *headers_str;
   
  @@ -415,8 +416,7 @@
                * Create response headers string
                */
               if (num_of_headers) {
  -                unsigned i;
  -                unsigned len_of_headers;
  +                size_t i, len_of_headers;
                   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]);
  @@ -442,7 +442,7 @@
               if (!p->lpEcb->ServerSupportFunction(p->lpEcb->ConnID,
                                                    HSE_REQ_SEND_RESPONSE_HEADER,
                                                    status_str,
  -                                                 (LPDWORD) & len_of_status,
  +                                                 (LPDWORD) &len_of_status,
                                                    (LPDWORD) headers_str)) {
                   jk_log(logger, JK_LOG_ERROR,
                          "jk_ws_service_t::start_response, ServerSupportFunction failed\n");
  @@ -496,7 +496,7 @@
                   /*
                    * Now try to read from the client ...
                    */
  -                if (p->lpEcb->ReadClient(p->lpEcb->ConnID, buf, &l)) {
  +                if (p->lpEcb->ReadClient(p->lpEcb->ConnID, buf, (LPDWORD)&l))
{
                       *a += l;
                   }
                   else {
  @@ -926,6 +926,8 @@
   
   BOOL WINAPI TerminateFilter(DWORD dwFlags)
   {
  +    UNREFERENCED_PARAMETER(dwFlags);
  +
       if (is_inited) {
           is_inited = JK_FALSE;
   
  @@ -953,7 +955,18 @@
       char fname[_MAX_FNAME];
       char file_name[_MAX_PATH];
   
  +    UNREFERENCED_PARAMETER(lpReserved);
  +
       switch (ulReason) {
  +    case DLL_PROCESS_ATTACH:
  +        if (GetModuleFileName(hInst, file_name, sizeof(file_name))) {
  +            _splitpath(file_name, drive, dir, fname, NULL);
  +            _makepath(ini_file_name, drive, dir, fname, ".properties");
  +        }
  +        else {
  +            fReturn = JK_FALSE;
  +        }
  +    break;
       case DLL_PROCESS_DETACH:
           __try {
               TerminateFilter(HSE_TERM_MUST_UNLOAD);
  @@ -965,13 +978,6 @@
       default:
           break;
       }
  -    if (GetModuleFileName(hInst, file_name, sizeof(file_name))) {
  -        _splitpath(file_name, drive, dir, fname, NULL);
  -        _makepath(ini_file_name, drive, dir, fname, ".properties");
  -    }
  -    else {
  -        fReturn = JK_FALSE;
  -    }
   
       return fReturn;
   }
  @@ -1340,7 +1346,6 @@
               s->num_attributes = num_of_vars;
               if (ssl_env_values[4] && ssl_env_values[4][0] == '1') {
                   CERT_CONTEXT_EX cc;
  -                DWORD cc_sz = sizeof(cc);
                   cc.cbAllocated = sizeof(huge_buf);
                   cc.CertContext.pbCertEncoded = (BYTE *) huge_buf;
                   cc.CertContext.cbCertEncoded = 0;
  @@ -1385,7 +1390,7 @@
           if (cnt) {
               char *headers_buf = jk_pool_strdup(&private_data->p, huge_buf);
               unsigned i;
  -            unsigned len_of_http_prefix = strlen("HTTP_");
  +            size_t len_of_http_prefix = strlen("HTTP_");
               BOOL need_content_length_header = (s->content_length == 0);
   
               cnt -= 2;           /* For our two special headers */
  @@ -1430,7 +1435,7 @@
                           *tmp = '-';
                       }
                       else {
  -                        *tmp = tolower(*tmp);
  +                        *tmp = JK_TOLOWER(*tmp);
                       }
                       tmp++;
                   }
  @@ -1466,7 +1471,7 @@
                * but non-zero length body.
                */
               if (need_content_length_header) {
  -                s->headers_names[cnt] = "content-length";
  +                s->headers_names[cnt] = "Content-Length";
                   s->headers_values[cnt] = "0";
                   cnt++;
               }
  @@ -1488,7 +1493,7 @@
                               char *name, char *buf, DWORD bufsz, char *def_val)
   {
       if (!lpEcb->GetServerVariable(lpEcb->ConnID,
  -                                  name, buf, (LPDWORD) & bufsz)) {
  +                                  name, buf, (LPDWORD) &bufsz)) {
           strcpy(buf, def_val);
           return JK_FALSE;
       }
  @@ -1516,7 +1521,7 @@
   }
   
   static int base64_encode_cert(char *encoded,
  -                              const unsigned char *string, int len)
  +                              const char *string, int len)
   {
       int i, c;
       char *p;
  @@ -1567,5 +1572,5 @@
           *p++ = *t++;
   
       *p++ = '\0';
  -    return p - encoded;
  +    return (int)(p - encoded);
   }
  
  
  

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


Mime
View raw message