fielding 97/04/07 04:47:07
Modified: src CHANGES http_request.c
Log:
The addition of <Location> and <File> directives made the
sub_req_lookup_simple() function bogus, so we now handle
the special cases directly. The patch affects mainly
multiviews into a file that matches a <Files> section.
Submitted by: Dean Gaudet
Reviewed by: Roy Fielding
Revision Changes Path
1.225 +4 -0 apache/src/CHANGES
Index: CHANGES
===================================================================
RCS file: /export/home/cvs/apache/src/CHANGES,v
retrieving revision 1.224
retrieving revision 1.225
diff -C3 -r1.224 -r1.225
*** CHANGES 1997/04/07 10:19:30 1.224
--- CHANGES 1997/04/07 11:47:05 1.225
***************
*** 1,5 ****
--- 1,9 ----
Changes with Apache 1.2b8
+ *) The addition of <Location> and <File> directives made the
+ sub_req_lookup_simple() function bogus, so we now handle
+ the special cases directly. [Dean Gaudet]
+
*) We now try to log where the server is dumping core when a fatal
signal is received. [Ken Coar]
1.47 +52 -55 apache/src/http_request.c
Index: http_request.c
===================================================================
RCS file: /export/home/cvs/apache/src/http_request.c,v
retrieving revision 1.46
retrieving revision 1.47
diff -C3 -r1.46 -r1.47
*** http_request.c 1997/02/21 00:22:29 1.46
--- http_request.c 1997/04/07 11:47:05 1.47
***************
*** 563,605 ****
return rr;
}
- request_rec *sub_req_lookup_simple (const char *new_file, const request_rec
*r)
- {
- /* This handles the simple case, common to ..._lookup_uri and _file,
- * of looking up another file in the same directory.
- */
- request_rec *rnew = make_sub_request (r);
- pool *rnewp = rnew->pool;
- int res;
-
- char *udir = make_dirstr(rnewp, r->uri, count_dirs(r->uri));
- char *fdir = make_dirstr(rnewp, r->filename, count_dirs(r->filename));
-
- *rnew = *r; /* Copy per_dir config, etc. */
- rnew->pool = rnewp;
- rnew->uri = make_full_path (rnewp, udir, new_file);
- rnew->filename = make_full_path (rnewp, fdir, new_file);
- set_sub_req_protocol (rnew, r);
-
- rnew->finfo.st_mode = 0;
-
- if ((res = check_symlinks (rnew->filename, allow_options (rnew))))
- {
- rnew->status = res;
- }
-
- if (rnew->finfo.st_mode == 0 && stat (rnew->filename, &rnew->finfo) < 0)
- rnew->finfo.st_mode = 0;
-
- if ((rnew->status == HTTP_OK) && (res = find_types (rnew)))
- rnew->status = res;
-
- if ((rnew->status == HTTP_OK) && (res = run_fixups (rnew)))
- rnew->status = res;
-
- return rnew;
- }
-
request_rec *sub_req_lookup_uri (const char *new_file, const request_rec *r)
{
--- 563,568 ----
***************
*** 681,712 ****
request_rec *rnew;
int res;
char *fdir;
-
- /* Check for a special case... if there are no '/' characters in
new_file
- * at all, then we are looking at a relative lookup in the same
directory.
- * That means we don't have to redo any access checks.
- */
-
- if (strchr (new_file, '/') == NULL)
- return sub_req_lookup_simple (new_file, r);
rnew = make_sub_request (r);
- fdir = make_dirstr (rnew->pool, r->filename, count_dirs (r->filename));
rnew->request_time = r->request_time;
rnew->connection = r->connection; /* For now... */
rnew->server = r->server;
rnew->request_config = create_request_config (rnew->pool);
rnew->htaccess = r->htaccess; /* copy htaccess cache */
- rnew->per_dir_config = r->server->lookup_defaults;
set_sub_req_protocol (rnew, r);
!
! rnew->uri = "INTERNALLY GENERATED file-relative req";
! rnew->filename = ((new_file[0] == '/') ?
! pstrdup(rnew->pool,new_file) :
! make_full_path (rnew->pool, fdir, new_file));
!
! if ((res = directory_walk (rnew))
! || (res = file_walk (rnew))
|| ((satisfies(rnew)==SATISFY_ALL ||
satisfies(rnew)==SATISFY_NOSPEC)?
((res = check_access (rnew))
|| (some_auth_required (rnew) &&
--- 644,709 ----
request_rec *rnew;
int res;
char *fdir;
rnew = make_sub_request (r);
rnew->request_time = r->request_time;
rnew->connection = r->connection; /* For now... */
rnew->server = r->server;
rnew->request_config = create_request_config (rnew->pool);
rnew->htaccess = r->htaccess; /* copy htaccess cache */
set_sub_req_protocol (rnew, r);
! fdir = make_dirstr (rnew->pool, r->filename, count_dirs (r->filename));
!
! /* Check for a special case... if there are no '/' characters in
new_file
! * at all, then we are looking at a relative lookup in the same
directory.
! * That means we won't have to redo directory_walk, and we may not
! * even have to redo access checks.
! */
!
! if (strchr (new_file, '/') == NULL) {
! char *udir = make_dirstr(rnew->pool, r->uri, count_dirs(r->uri));
!
! rnew->uri = make_full_path (rnew->pool, udir, new_file);
! rnew->filename = make_full_path (rnew->pool, fdir, new_file);
! if (stat (rnew->filename, &rnew->finfo) < 0) {
! rnew->finfo.st_mode = 0;
! }
!
! rnew->per_dir_config = r->per_dir_config;
!
! if ((res = check_symlinks (rnew->filename, allow_options (rnew)))) {
! log_reason ("Symbolic link not allowed", rnew->filename, rnew);
! rnew->status = res;
! return rnew;
! }
! /* do a file_walk, if it doesn't change the per_dir_config then
! * we know that we don't have to redo all the access checks */
! if ((res = file_walk (rnew))) {
! rnew->status = res;
! return rnew;
! }
! if (rnew->per_dir_config == r->per_dir_config) {
! if ((res = find_types (rnew)) || (res = run_fixups (rnew))) {
! rnew->status = res;
! }
! return rnew;
! }
! } else {
! /* XXX: this should be set properly like it is in the same-dir case
! * but it's actually sometimes to impossible to do it... because the
! * file may not have a uri associated with it -djg */
! rnew->uri = "INTERNALLY GENERATED file-relative req";
! rnew->filename = ((new_file[0] == '/') ?
! pstrdup(rnew->pool,new_file) :
! make_full_path (rnew->pool, fdir, new_file));
! rnew->per_dir_config = r->server->lookup_defaults;
! res = directory_walk (rnew);
! if (!res) {
! res = file_walk (rnew);
! }
! }
!
! if (res
|| ((satisfies(rnew)==SATISFY_ALL ||
satisfies(rnew)==SATISFY_NOSPEC)?
((res = check_access (rnew))
|| (some_auth_required (rnew) &&