httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bnicho...@apache.org
Subject cvs commit: apache-1.3/src/os/netware os.h os.c
Date Tue, 21 Aug 2001 20:22:09 GMT
bnicholes    01/08/21 13:22:09

  Modified:    src/os/netware os.h os.c
  Log:
  Fixed ap_os_canonical_filename() and ap_os_is_path_absolute() so that they
  would recognize special file names such as proxy:http://blah correctly.
  
  Revision  Changes    Path
  1.19      +16 -9     apache-1.3/src/os/netware/os.h
  
  Index: os.h
  ===================================================================
  RCS file: /home/cvs/apache-1.3/src/os/netware/os.h,v
  retrieving revision 1.18
  retrieving revision 1.19
  diff -u -r1.18 -r1.19
  --- os.h	2001/08/13 17:12:38	1.18
  +++ os.h	2001/08/21 20:22:09	1.19
  @@ -138,16 +138,23 @@
   
   inline int ap_os_is_path_absolute(const char *file)
   {
  -    char *s = strchr (file, ':');
  +    char *s = strstr (file, "://");
  +
  +    /* First make sure we aren't looking at a URL such as
  +        a proxy:http://blah.
  +    */
  +    if (!s) {
  +        s = strchr (file, ':');
       
  -    if (s) {
  -        if (strncmp(s, "://", 3) != 0)
  -	    /* XXX: we assume that everything before the : is letters */
  -            return 1;
  -    }
  -    else {
  -        if (file[0] == '/')
  -            return 1;
  +        if (s) {
  +            if (strncmp(s, "://", 3) != 0)
  +	        /* XXX: we assume that everything before the : is letters */
  +                return 1;
  +        }
  +        else {
  +            if (file[0] == '/')
  +                return 1;
  +        }
       }
       	
       return 0;
  
  
  
  1.18      +17 -11    apache-1.3/src/os/netware/os.c
  
  Index: os.c
  ===================================================================
  RCS file: /home/cvs/apache-1.3/src/os/netware/os.c,v
  retrieving revision 1.17
  retrieving revision 1.18
  diff -u -r1.17 -r1.18
  --- os.c	2001/08/13 17:12:38	1.17
  +++ os.c	2001/08/21 20:22:09	1.18
  @@ -168,19 +168,25 @@
       char *slash_test;
   	
       bslash2slash(pNewName);
  -    if ((pNewName[0] == '/') && (strchr (pNewName, ':') == NULL))
  -    {
  -        char vol[256];
  +    /* Don't try to canonicalize a filename that isn't even valid
  +        This way we don't mess up proxy requests or other kinds
  +        of special filenames.
  +    */
  +    if (ap_os_is_filename_valid(pNewName)) {
  +        if ((pNewName[0] == '/') && (strchr (pNewName, ':') == NULL))
  +        {
  +            char vol[256];
   
  -        _splitpath (ap_server_root, vol, NULL, NULL, NULL);
  -        pNewName = ap_pstrcat (pPool, vol, pNewName, NULL);
  -    }
  -    if ((slash_test = strchr(pNewName, ':')) && (*(slash_test+1) != '/'))
  -    {
  -        char vol[_MAX_VOLUME+1];
  +            _splitpath (ap_server_root, vol, NULL, NULL, NULL);
  +            pNewName = ap_pstrcat (pPool, vol, pNewName, NULL);
  +        }
  +        if ((slash_test = strchr(pNewName, ':')) && (*(slash_test+1) != '/'))
  +        {
  +            char vol[_MAX_VOLUME+1];
           
  -        _splitpath (pNewName, vol, NULL, NULL, NULL);
  -        pNewName = ap_pstrcat (pPool, vol, "/", pNewName+strlen(vol), NULL);
  +            _splitpath (pNewName, vol, NULL, NULL, NULL);
  +            pNewName = ap_pstrcat (pPool, vol, "/", pNewName+strlen(vol), NULL);
  +        }
       }
       strlwr(pNewName);
       return pNewName;
  
  
  

Mime
View raw message