httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Marc Slemko <ma...@znep.com>
Subject Re: possible long url index fix
Date Sun, 12 Jan 1997 00:47:41 GMT
Linux seems to be fine with ENOENT all the way back to 1.0, but... some
things probably won't be since I _think_ only EDOM and ERANGE are
absolutely required by one of the specs.

Ok, new patch.  The only difference is this one wraps the changes inside
an ifdef ENOENT, so if ENOENT isn't defined we just do things the old way.

The only question is do we want to put something like an #error inside the
else that people have to remove before it will compile if they don't have
ENOENT, so they know the consequences. 

Index: http_request.c
===================================================================
RCS file: /home/marcs/archive/apache/cvs/apache/src/http_request.c,v
retrieving revision 1.35
diff -c -r1.35 http_request.c
*** http_request.c	1997/01/04 15:10:16	1.35
--- http_request.c	1997/01/12 00:45:30
***************
*** 137,143 ****
  /* Dealing with the file system to get PATH_INFO
   */
  
! void get_path_info(request_rec *r)
  {
      char *cp;
      char *path = r->filename;
--- 137,143 ----
  /* Dealing with the file system to get PATH_INFO
   */
  
! int get_path_info(request_rec *r)
  {
      char *cp;
      char *path = r->filename;
***************
*** 155,161 ****
--- 155,164 ----
  	/* See if the pathname ending here exists... */
        
  	*cp = '\0';
+ 
+ 	errno = 0;
  	rv = stat(path, &r->finfo);
+ 
  	if (cp != end) *cp = '/';
        
  	if (!rv) {
***************
*** 172,180 ****
  	
  	    r->path_info = pstrdup (r->pool, cp);
  	    *cp = '\0';
! 	    return;
  	}
  	else {
  	    last_cp = cp;
  	
  	    while (--cp > path && *cp != '/')
--- 175,187 ----
  	
  	    r->path_info = pstrdup (r->pool, cp);
  	    *cp = '\0';
! 	    return OK;
  	}
+ #if defined(ENOENT)
+ 	else if (errno == ENOENT) {
+ #else
  	else {
+ #endif
  	    last_cp = cp;
  	
  	    while (--cp > path && *cp != '/')
***************
*** 182,189 ****
--- 189,203 ----
  
  	    while (cp > path && cp[-1] == '/')
  		--cp;
+ 	} 
+ #if defined(ENOENT)
+ 	else {
+ 	    log_reason("unable to determine if index file exists (stat() returned unexpected error)",
r->filename, r);
+ 	    return HTTP_FORBIDDEN;
  	}
+ #endif
      }
+     return OK;
  }
  
  int directory_walk (request_rec *r)
***************
*** 269,275 ****
      no2slash (test_filename);
      num_dirs = count_dirs(test_filename);
  
!     get_path_info (r);
      
      if (test_filename[strlen(test_filename)-1] == '/')
  	--num_dirs;
--- 283,292 ----
      no2slash (test_filename);
      num_dirs = count_dirs(test_filename);
  
!     res = get_path_info (r);
!     if (res != OK) {
! 	return res;
!     }
      
      if (test_filename[strlen(test_filename)-1] == '/')
  	--num_dirs;




Mime
View raw message