fielding    97/05/08 00:32:34

  Modified:    src       CHANGES util_script.c
  Log:
  The method for determining PATH_INFO has been restored to the pre-1.2b
  (and NCSA httpd) implementation wherein it was the extra path info beyond
  the CGI script filename.  The environment variable FILEPATH_INFO has
  been removed, and instead we supply the original REQUEST_URI to any
  script that wants to be Apache-specific and needs the real URI path.
  This solves a problem with existing scripts that use extra path info
  in the ScriptAlias directive to pass options to the CGI script.
  
  Reviewed by: Jim Jagielski, Paul Sutton
  
  Revision  Changes    Path
  1.266     +10 -0     apache/src/CHANGES
  
  Index: CHANGES
  ===================================================================
  RCS file: /export/home/cvs/apache/src/CHANGES,v
  retrieving revision 1.265
  retrieving revision 1.266
  diff -C3 -r1.265 -r1.266
  *** CHANGES   1997/05/04 20:28:13     1.265
  --- CHANGES   1997/05/08 07:32:32     1.266
  ***************
  *** 1,5 ****
  --- 1,14 ----
    Changes with Apache 1.2
    
  +   *) The method for determining PATH_INFO has been restored to the pre-1.2b
  +      (and NCSA httpd) definition wherein it was the extra path info beyond
  +      the CGI script filename.  The environment variable FILEPATH_INFO has
  +      been removed, and instead we supply the original REQUEST_URI to any
  +      script that wants to be Apache-specific and needs the real URI path.
  +      This solves a problem with existing scripts that use extra path info
  +      in the ScriptAlias directive to pass options to the CGI script.
  +      [Roy Fielding]
  + 
      *) The _default_ change in 1.2b10 will change the behaviour on configs
         that use multiple Listen statements for listening on multiple ports.
         But that change is necessary to make _default_ consistent with other
  ***************
  *** 705,710 ****
  --- 714,720 ----
      *) Add FILEPATH_INFO variable to CGI environment, which is equal to
         PATH_INFO from previous versions of Apache (in certain situations,
         Apache 1.2's PATH_INFO will be different than 1.1's). [Alexei Kosut]
  +      [later removed in 1.2b11]
    
      *) Add rwrite() function to API to allow for sending strings of
         arbitrary length. [Doug MacEachern]
  
  
  
  1.57      +18 -13    apache/src/util_script.c
  
  Index: util_script.c
  ===================================================================
  RCS file: /export/home/cvs/apache/src/util_script.c,v
  retrieving revision 1.56
  retrieving revision 1.57
  diff -C3 -r1.56 -r1.57
  *** util_script.c     1997/04/29 04:45:52     1.56
  --- util_script.c     1997/05/08 07:32:32     1.57
  ***************
  *** 238,243 ****
  --- 238,257 ----
        return lu;
    }
    
  + static char *original_uri(request_rec *r)
  + {
  +     char *last;
  +     char *first = r->the_request;
  + 
  +     while (*first && !isspace(*first)) ++first;
  +     while (isspace(*first)) ++first;
  + 
  +     last = first;
  +     while (*last && !isspace(*last)) ++last;
  +     
  +     return pstrndup(r->pool, first, last - first);
  + }
  + 
    void add_cgi_vars(request_rec *r)
    {
        table *e = r->subprocess_env;
  ***************
  *** 246,252 ****
        table_set (e, "SERVER_PROTOCOL", r->protocol);
        table_set (e, "REQUEST_METHOD", r->method);
        table_set (e, "QUERY_STRING", r->args ? r->args : "");
  !     
        /* Note that the code below special-cases scripts run from includes,
         * because it "knows" that the sub_request has been hacked to have the
         * args and path_info of the original request, and not any that may have
  --- 260,267 ----
        table_set (e, "SERVER_PROTOCOL", r->protocol);
        table_set (e, "REQUEST_METHOD", r->method);
        table_set (e, "QUERY_STRING", r->args ? r->args : "");
  !     table_set (e, "REQUEST_URI", original_uri(r));
  ! 
        /* Note that the code below special-cases scripts run from includes,
         * because it "knows" that the sub_request has been hacked to have the
         * args and path_info of the original request, and not any that may have
  ***************
  *** 264,283 ****
    
        table_set (e, "SCRIPT_NAME", pstrndup(r->pool, r->uri,
                                              path_info_start));
  !     table_set (e, "PATH_INFO", r->uri + path_info_start);
        }
        
  -     /* Some CGI apps need the old-style PATH_INFO (taken from the
  -      * filename, not the URL), so we provide it in a different env
  -      * variable. CGI scripts can use something like (in Perl)
  -      * $path_info = $ENV{'FILEPATH_INFO'} || $ENV{'PATH_INFO'};
  -      * to get the right information with both old and new
  -      * versions of Apache (and other servers).
  -      */
  - 
  -     if (r->path_info && *r->path_info)
  -     table_set (e, "FILEPATH_INFO", r->path_info);
  - 
        if (r->path_info && r->path_info[0]) {
        /*
         * To get PATH_TRANSLATED, treat PATH_INFO as a URI path.
  --- 279,288 ----
    
        table_set (e, "SCRIPT_NAME", pstrndup(r->pool, r->uri,
                                              path_info_start));
  ! 
  !     table_set (e, "PATH_INFO", r->path_info);
        }
        
        if (r->path_info && r->path_info[0]) {
        /*
         * To get PATH_TRANSLATED, treat PATH_INFO as a URI path.
  
  
  

Reply via email to