Commit 68c39898 authored by William A. Rowe Jr's avatar William A. Rowe Jr
Browse files

  Employ the new ap_sub_req_lookup_dirent() function for mod_autoindex.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@89448 13f79535-47bb-0310-9956-ffa450edef68
parent 24ca66bf
Loading
Loading
Loading
Loading
+8 −7
Original line number Original line Diff line number Diff line
@@ -1159,23 +1159,24 @@ static char *find_title(request_rec *r)
    return NULL;
    return NULL;
}
}


static struct ent *make_autoindex_entry(const char *name, int autoindex_opts,
static struct ent *make_autoindex_entry(const apr_finfo_t *dirent, 
                                        int autoindex_opts,
					autoindex_config_rec *d,
					autoindex_config_rec *d,
					request_rec *r, char keyid,
					request_rec *r, char keyid,
					char direction)
					char direction)
{
{
    struct ent *p;
    struct ent *p;


    if ((name[0] == '.') && (!name[1])) {
    if ((dirent->name[0] == '.') && (!dirent->name[1])) {
	return (NULL);
	return (NULL);
    }
    }


    if (ignore_entry(d, ap_make_full_path(r->pool, r->filename, name))) {
    if (ignore_entry(d, ap_make_full_path(r->pool, r->filename, dirent->name))) {
        return (NULL);
        return (NULL);
    }
    }


    p = (struct ent *) apr_pcalloc(r->pool, sizeof(struct ent));
    p = (struct ent *) apr_pcalloc(r->pool, sizeof(struct ent));
    p->name = apr_pstrdup(r->pool, name);
    p->name = apr_pstrdup(r->pool, dirent->name);
    p->size = -1;
    p->size = -1;
    p->icon = NULL;
    p->icon = NULL;
    p->alt = NULL;
    p->alt = NULL;
@@ -1186,7 +1187,7 @@ static struct ent *make_autoindex_entry(const char *name, int autoindex_opts,
    p->version_sort = autoindex_opts & VERSION_SORT;
    p->version_sort = autoindex_opts & VERSION_SORT;


    if (autoindex_opts & FANCY_INDEXING) {
    if (autoindex_opts & FANCY_INDEXING) {
        request_rec *rr = ap_sub_req_lookup_file(name, r, NULL);
        request_rec *rr = ap_sub_req_lookup_dirent(dirent, r, NULL);


	if (rr->finfo.filetype != 0) {
	if (rr->finfo.filetype != 0) {
	    p->lm = rr->finfo.mtime;
	    p->lm = rr->finfo.mtime;
@@ -1198,7 +1199,7 @@ static struct ent *make_autoindex_entry(const char *name, int autoindex_opts,
		    p->alt = "DIR";
		    p->alt = "DIR";
		}
		}
		p->size = -1;
		p->size = -1;
		p->name = apr_pstrcat(r->pool, name, "/", NULL);
		p->name = apr_pstrcat(r->pool, dirent->name, "/", NULL);
	    }
	    }
	    else {
	    else {
		p->icon = find_icon(d, rr, 0);
		p->icon = find_icon(d, rr, 0);
@@ -1622,7 +1623,7 @@ static int index_directory(request_rec *r,
     */
     */
    head = NULL;
    head = NULL;
    while (apr_dir_read(&dirent, APR_FINFO_DIRENT, thedir) == APR_SUCCESS) {
    while (apr_dir_read(&dirent, APR_FINFO_DIRENT, thedir) == APR_SUCCESS) {
	p = make_autoindex_entry(dirent.name, autoindex_opts,
	p = make_autoindex_entry(&dirent, autoindex_opts,
				 autoindex_conf, r, keyid, direction);
				 autoindex_conf, r, keyid, direction);
	if (p != NULL) {
	if (p != NULL) {
	    p->next = head;
	    p->next = head;