Received: by taz.hyperreal.com (8.8.3/V2.0) id PAA11848; Sat, 11 Jan 1997 15:04:16 -0800 (PST) Received: from sierra.zyzzyva.com by taz.hyperreal.com (8.8.3/V2.0) with ESMTP id PAA11837; Sat, 11 Jan 1997 15:04:11 -0800 (PST) Received: from sierra (localhost [127.0.0.1]) by sierra.zyzzyva.com (8.8.4/8.8.2) with ESMTP id RAA22666 for ; Sat, 11 Jan 1997 17:04:56 -0600 (CST) Message-Id: <199701112304.RAA22666@sierra.zyzzyva.com> To: new-httpd@hyperreal.com Subject: Re: possible long url index fix In-reply-to: marcs's message of Sat, 11 Jan 1997 15:47:44 -0700. X-uri: http://www.zyzzyva.com/ Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Sat, 11 Jan 1997 17:04:56 -0600 From: Randy Terbush Sender: new-httpd-owner@apache.org Precedence: bulk Reply-To: new-httpd@hyperreal.com > 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;