httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jerenkra...@apache.org
Subject cvs commit: httpd-2.0 CHANGES
Date Thu, 07 Feb 2002 06:37:10 GMT
jerenkrantz    02/02/06 22:37:10

  Modified:    modules/generators mod_autoindex.c
               .        CHANGES
  Log:
  Allow mod_autoindex to serve symlinks if permitted and optimize our stats
  so that only one stat() is needed.
  
  If we get APR_FINFO_MIN bits, lookup_dirent won't do a repeated stat()
  call.  So, let's do it here.  Also, if we see a symlink, expand it.
  (Technically, we don't *have* to expand the symlinks - the resolve_symlink
  fix handles that, but we can't really assume that.)  Since we know that
  dirent will be rr->finfo anyway, go back to relying on dirent only for
  APR_DIR checks.
  
  Revision  Changes    Path
  1.96      +28 -3     httpd-2.0/modules/generators/mod_autoindex.c
  
  Index: mod_autoindex.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/modules/generators/mod_autoindex.c,v
  retrieving revision 1.95
  retrieving revision 1.96
  diff -u -r1.95 -r1.96
  --- mod_autoindex.c	5 Feb 2002 15:35:54 -0000	1.95
  +++ mod_autoindex.c	7 Feb 2002 06:37:09 -0000	1.96
  @@ -1298,7 +1298,7 @@
       }
   
       p = (struct ent *) apr_pcalloc(r->pool, sizeof(struct ent));
  -    if (rr->finfo.filetype == APR_DIR) {
  +    if (dirent->filetype == APR_DIR) {
           p->name = apr_pstrcat(r->pool, dirent->name, "/", NULL);
       }
       else {
  @@ -1316,7 +1316,7 @@
   
       if (autoindex_opts & (FANCY_INDEXING | TABLE_INDEXING)) {
           p->lm = rr->finfo.mtime;
  -        if (rr->finfo.filetype == APR_DIR) {
  +        if (dirent->filetype == APR_DIR) {
               if (autoindex_opts & FOLDERS_FIRST) {
                   p->isdir = 1;
               }
  @@ -1885,6 +1885,8 @@
       char keyid;
       char direction;
       char *colargs;
  +    char *fullpath;
  +    apr_size_t dirpathlen;
   
       if ((status = apr_dir_open(&thedir, name, r->pool)) != APR_SUCCESS) {
           ap_log_rerror(APLOG_MARK, APLOG_ERR, status, r,
  @@ -2023,7 +2025,30 @@
           head = p;
           num_ent++;
       }
  -    while (apr_dir_read(&dirent, APR_FINFO_DIRENT, thedir) == APR_SUCCESS) {
  +    fullpath = apr_palloc(r->pool, APR_PATH_MAX);
  +    dirpathlen = strlen(name);
  +    memcpy(fullpath, name, dirpathlen);
  +    while (apr_dir_read(&dirent, APR_FINFO_MIN | APR_FINFO_NAME, thedir) == APR_SUCCESS)
{
  +        /* We want to explode symlinks here. */
  +        if (dirent.filetype == APR_LNK) {
  +            const char *savename;
  +            apr_finfo_t fi;
  +            /* We *must* have FNAME. */
  +            savename = dirent.name;
  +            apr_cpystrn(fullpath + dirpathlen, dirent.name,
  +                        APR_PATH_MAX - dirpathlen);
  +            status = apr_stat(&fi, fullpath, 
  +                              dirent.valid & ~(APR_FINFO_NAME), r->pool);
  +            if (status != APR_SUCCESS) {
  +                /* Something bad happened, skip this file. */
  +                continue;
  +            }
  +            memcpy(&dirent, &fi, sizeof(fi));
  +            if (savename) {
  +                dirent.name = savename;
  +                dirent.valid |= APR_FINFO_NAME;
  +            }
  +        }
           p = make_autoindex_entry(&dirent, autoindex_opts, autoindex_conf, r, 
                                    keyid, direction, pstring);
           if (p != NULL) {
  
  
  
  1.569     +4 -0      httpd-2.0/CHANGES
  
  Index: CHANGES
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/CHANGES,v
  retrieving revision 1.568
  retrieving revision 1.569
  diff -u -r1.568 -r1.569
  --- CHANGES	7 Feb 2002 06:29:57 -0000	1.568
  +++ CHANGES	7 Feb 2002 06:37:09 -0000	1.569
  @@ -1,5 +1,9 @@
   Changes with Apache 2.0.32-dev
   
  +  *) Allow mod_autoindex to serve symlinks if permitted and attempt to
  +     do only one stat() call when generating the directory listings.
  +     [Justin Erenkrantz]
  +
     *) Fix resolve_symlink to save the original symlink name if known.
        [Justin Erenkrantz]
   
  
  
  

Mime
View raw message