You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by la...@apache.org on 2002/01/05 05:25:21 UTC

cvs commit: jakarta-tomcat/src/native/mod_jk/iis jk_isapi_plugin.c

larryi      02/01/04 20:25:20

  Modified:    src/native/mod_jk/iis jk_isapi_plugin.c
  Log:
  In HttpFilterProc, the '?' is searched for in an escaped URI.  In
  init_ws_service as part of HttpExtensionProc, the '?' is searched for
  in a URI that has been unescaped.  This isn't guaranteed to find the
  same '?'.  To avoid this, save the query string in it's own "tomcat"
  header and use that in init_ws_service instead of searching again.
  
  Added some logging if the worker and worker mount files are not found.
  
  Fix some tabs and a typo.
  
  Revision  Changes    Path
  1.11      +22 -29    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.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- jk_isapi_plugin.c	8 Dec 2001 15:40:59 -0000	1.10
  +++ jk_isapi_plugin.c	5 Jan 2002 04:25:20 -0000	1.11
  @@ -57,7 +57,7 @@
    * Description: ISAPI plugin for IIS/PWS                                   *
    * Author:      Gal Shachor <sh...@il.ibm.com>                           *
    * Author:      Ignacio J. Ortega <na...@apache.org>                       *
  - * Version:     $Revision: 1.10 $                                           *
  + * Version:     $Revision: 1.11 $                                           *
    ***************************************************************************/
   
   // This define is needed to include wincrypt,h, needed to get client certificates
  @@ -87,10 +87,12 @@
    *
    */
   #define URI_HEADER_NAME         ("TOMCATURI:")
  +#define QUERY_HEADER_NAME       ("TOMCATQUERY:")
   #define WORKER_HEADER_NAME      ("TOMCATWORKER:")
   #define CONTENT_LENGTH          ("CONTENT_LENGTH:")
   
   #define HTTP_URI_HEADER_NAME     ("HTTP_TOMCATURI")
  +#define HTTP_QUERY_HEADER_NAME   ("HTTP_TOMCATQUERY")
   #define HTTP_WORKER_HEADER_NAME  ("HTTP_TOMCATWORKER")
   
   #define REGISTRY_LOCATION       ("Software\\Apache Software Foundation\\Jakarta Isapi Redirector\\1.0")
  @@ -545,8 +547,8 @@
          (SF_NOTIFY_PREPROC_HEADERS == dwNotificationType)) { 
           PHTTP_FILTER_PREPROC_HEADERS p = (PHTTP_FILTER_PREPROC_HEADERS)pvNotification;
           char uri[INTERNET_MAX_URL_LENGTH];
  -		char snuri[INTERNET_MAX_URL_LENGTH]="/";
  -		char Host[INTERNET_MAX_URL_LENGTH];
  +        char snuri[INTERNET_MAX_URL_LENGTH]="/";
  +        char Host[INTERNET_MAX_URL_LENGTH];
   
           char *query;
           DWORD sz = sizeof(uri);
  @@ -559,7 +561,8 @@
            * Just in case somebody set these headers in the request!
            */
           p->SetHeader(pfc, URI_HEADER_NAME, NULL);
  -	    p->SetHeader(pfc, WORKER_HEADER_NAME, NULL);
  +        p->SetHeader(pfc, QUERY_HEADER_NAME, NULL);
  +        p->SetHeader(pfc, WORKER_HEADER_NAME, NULL);
           
           if(!p->GetHeader(pfc, "url", (LPVOID)uri, (LPDWORD)&sz)) {
               jk_log(logger, JK_LOG_ERROR, 
  @@ -572,13 +575,13 @@
               char *worker=0;
               query = strchr(uri, '?');
               if(query) {
  -                *query = '\0';
  +                *query++ = '\0';
               }
   
               rc = unescape_url(uri);
               if (rc == BAD_REQUEST) {
                   jk_log(logger, JK_LOG_ERROR, 
  -                       "HttpFilterProc [%s] contains on or more invalid escape sequences.\n", 
  +                       "HttpFilterProc [%s] contains one or more invalid escape sequences.\n", 
                          uri);
                   write_error_response(pfc,"400 Bad Request",
                           "<HTML><BODY><H1>Request contains invalid encoding</H1></BODY></HTML>");
  @@ -608,17 +611,6 @@
                          uri);
                   worker = map_uri_to_worker(uw_map, uri, logger);
               }
  -            if(query) {
  -                char *querytmp = uri + strlen(uri);
  -                *querytmp++ = '?';
  -                query++;
  -                /* if uri was shortened, move the query characters */
  -                if (querytmp != query) {
  -                    while (*query != '\0')
  -                        *querytmp++ = *query++;
  -                    *querytmp = '\0';
  -                }
  -            }
   
               if(worker) {
                   /* This is a servlet, should redirect ... */
  @@ -627,7 +619,9 @@
                          uri, worker);
   
                   
  -				if(!p->AddHeader(pfc, URI_HEADER_NAME, uri) || 
  +                if(!p->AddHeader(pfc, URI_HEADER_NAME, uri) || 
  +                   ( (query != NULL && strlen(query) > 0)
  +                           ? !p->AddHeader(pfc, QUERY_HEADER_NAME, query) : FALSE ) || 
                      !p->AddHeader(pfc, WORKER_HEADER_NAME, worker) ||
                      !p->SetHeader(pfc, "url", extension_uri)) {
                       jk_log(logger, JK_LOG_ERROR, 
  @@ -825,6 +819,10 @@
                   if(uri_worker_map_alloc(&uw_map, map, logger)) {
                       rc = JK_TRUE;
                   }
  +            } else {
  +                jk_log(logger, JK_LOG_EMERG, 
  +                        "Unable to read worker mount file %s.\n", 
  +                        worker_mount_file);
               }
               map_free(&map);
           }
  @@ -836,6 +834,10 @@
                       if(wc_open(map, logger)) {
                           rc = JK_TRUE;
                       }
  +                } else {
  +                    jk_log(logger, JK_LOG_EMERG, 
  +                            "Unable to read worker file %s.\n", 
  +                            worker_file);
                   }
                   map_free(&map);
               }
  @@ -994,18 +996,9 @@
   
       GET_SERVER_VARIABLE_VALUE(HTTP_WORKER_HEADER_NAME, (*worker_name));           
       GET_SERVER_VARIABLE_VALUE(HTTP_URI_HEADER_NAME, s->req_uri);     
  +    GET_SERVER_VARIABLE_VALUE(HTTP_QUERY_HEADER_NAME, s->query_string);     
   
  -    if(s->req_uri) {
  -        char *t = strchr(s->req_uri, '?');
  -        if(t) {
  -            *t = '\0';
  -            t++;
  -            if(!strlen(t)) {
  -                t = NULL;
  -            }
  -        }
  -        s->query_string = t;
  -    } else {
  +    if(s->req_uri == NULL) {
           s->query_string = private_data->lpEcb->lpszQueryString;
           *worker_name    = JK_AJP12_WORKER_NAME;
           GET_SERVER_VARIABLE_VALUE("URL", s->req_uri);       
  
  
  

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>