httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Randy Terbush <ra...@zyzzyva.com>
Subject Re: possible long url index fix
Date Sat, 11 Jan 1997 23:04:56 GMT
> Comments?

This all looks fine. Portable to any system I have access to.
BSDI, FreeBSD, NetBSD, SunOS 5.5

My plan is to apply this and the other patch to 1.1.1 and roll a
1.1.2 in the next hour. Agreed?



> The things I am especially concerned about: 
> 	- am I doing the error code returning stuff right
> 	- any other 'legit' errno's that stat could set which would still
> 	  be a definite no index.html exists?
> 	- portability
> 
> 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/11 22:45:08
> ***************
> *** 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,183 ----
>   	
>   	    r->path_info = pstrdup (r->pool, cp);
>   	    *cp = '\0';
> ! 	    return OK;
>   	}
> ! 	else if (errno == ENOENT) {
>   	    last_cp = cp;
>   	
>   	    while (--cp > path && *cp != '/')
> ***************
> *** 182,189 ****
> --- 185,198 ----
>   
>   	    while (cp > path && cp[-1] == '/')
>   		--cp;
> + 	} 
> + 	else {
> + 	    log_reason("unable to determine if index file exists (stat() returned unexpected
error)", r->filename, r);
> + 	    return HTTP_FORBIDDEN;
>   	}
> + 
>       }
> +     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;
> --- 278,287 ----
>       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