httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From wr...@apache.org
Subject cvs commit: httpd-2.0/server config.c
Date Tue, 23 Jan 2001 04:14:24 GMT
wrowe       01/01/22 20:14:24

  Modified:    modules/dav/fs repos.c
               modules/generators mod_autoindex.c
               modules/mappers mod_negotiation.c mod_speling.c
               server   config.c
  Log:
    Accomodate the change to the apr_read_dir() arguments, and change all
    apr_dirfoo() and apr_foodir() commands to apr_dir_foo() to match the
    earlier-renamed apr_dir_open().
  
  Revision  Changes    Path
  1.45      +13 -11    httpd-2.0/modules/dav/fs/repos.c
  
  Index: repos.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/modules/dav/fs/repos.c,v
  retrieving revision 1.44
  retrieving revision 1.45
  diff -u -r1.44 -r1.45
  --- repos.c	2001/01/20 21:42:17	1.44
  +++ repos.c	2001/01/23 04:14:21	1.45
  @@ -1315,6 +1315,7 @@
       apr_pool_t *pool = params->pool;
       dav_error *err = NULL;
       int isdir = fsctx->res1.collection;
  +    apr_finfo_t dirent;
       apr_dir_t *dirp;
   
       /* ensure the context is prepared properly, then call the func */
  @@ -1357,15 +1358,14 @@
   	/* ### need a better error */
   	return dav_new_error(pool, HTTP_NOT_FOUND, 0, NULL);
       }
  -    while ((apr_readdir(dirp)) == APR_SUCCESS) {
  -	const char *name;
  +    while ((apr_dir_read(&dirent, APR_FINFO_DIRENT, dirp)) == APR_SUCCESS) {
   	apr_size_t len;
   
  -	apr_get_dir_filename(&name, dirp);
  -	len = strlen(name);
  +	len = strlen(dirent.name);
   
   	/* avoid recursing into our current, parent, or state directories */
  -	if (name[0] == '.' && (len == 1 || (name[1] == '.' && len == 2))) {
  +	if (dirent.name[0] == '.' 
  +              && (len == 1 || (dirent.name[1] == '.' && len == 2))) {
   	    continue;
   	}
   
  @@ -1374,19 +1374,21 @@
   	    /* ### example: .htaccess is normally configured to fail auth */
   
   	    /* stuff in the state directory is never authorized! */
  -	    if (!strcmp(name, DAV_FS_STATE_DIR)) {
  +	    if (!strcmp(dirent.name, DAV_FS_STATE_DIR)) {
   		continue;
   	    }
   	}
   	/* skip the state dir unless a HIDDEN is performed */
   	if (!(params->walk_type & DAV_WALKTYPE_HIDDEN)
  -	    && !strcmp(name, DAV_FS_STATE_DIR)) {
  +	    && !strcmp(dirent.name, DAV_FS_STATE_DIR)) {
   	    continue;
   	}
   
   	/* append this file onto the path buffer (copy null term) */
  -	dav_buffer_place_mem(pool, &fsctx->path1, name, len + 1, 0);
  +	dav_buffer_place_mem(pool, &fsctx->path1, dirent.name, len + 1, 0);
   
  +
  +        /* ### Optimize me, dirent can give us what we need! */
           if (apr_lstat(&fsctx->info1.finfo, fsctx->path1.buf, 
                         APR_FINFO_NORM, pool) != APR_SUCCESS) {
   	    /* woah! where'd it go? */
  @@ -1397,11 +1399,11 @@
   
   	/* copy the file to the URI, too. NOTE: we will pad an extra byte
   	   for the trailing slash later. */
  -	dav_buffer_place_mem(pool, &fsctx->uri_buf, name, len + 1, 1);
  +	dav_buffer_place_mem(pool, &fsctx->uri_buf, dirent.name, len + 1, 1);
   
   	/* if there is a secondary path, then do that, too */
   	if (fsctx->path2.buf != NULL) {
  -	    dav_buffer_place_mem(pool, &fsctx->path2, name, len + 1, 0);
  +	    dav_buffer_place_mem(pool, &fsctx->path2, dirent.name, len + 1, 0);
   	}
   
   	/* set up the (internal) pathnames for the two resources */
  @@ -1458,7 +1460,7 @@
       }
   
       /* ### check the return value of this? */
  -    apr_closedir(dirp);
  +    apr_dir_close(dirp);
   
       if (err != NULL)
   	return err;
  
  
  
  1.54      +7 -9      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.53
  retrieving revision 1.54
  diff -u -r1.53 -r1.54
  --- mod_autoindex.c	2001/01/19 07:04:20	1.53
  +++ mod_autoindex.c	2001/01/23 04:14:22	1.54
  @@ -1540,8 +1540,8 @@
       char *title_name = ap_escape_html(r->pool, r->uri);
       char *title_endp;
       char *name = r->filename;
  -
  -    apr_dir_t *d;
  +    apr_finfo_t dirent;
  +    apr_dir_t *thedir;
       apr_status_t status;
       int num_ent = 0, x;
       struct ent *head, *p;
  @@ -1551,7 +1551,7 @@
       char keyid;
       char direction;
   
  -    if ((status = apr_dir_open(&d, name, r->pool)) != APR_SUCCESS) {
  +    if ((status = apr_dir_open(&thedir, name, r->pool)) != APR_SUCCESS) {
   	ap_log_rerror(APLOG_MARK, APLOG_ERR, status, r,
   		    "Can't open directory for index: %s", r->filename);
   	return HTTP_FORBIDDEN;
  @@ -1569,7 +1569,7 @@
       ap_send_http_header(r);
   
       if (r->header_only) {
  -	apr_closedir(d);
  +	apr_dir_close(thedir);
   	return 0;
       }
   
  @@ -1621,10 +1621,8 @@
        * linked list and then arrayificate them so qsort can use them. 
        */
       head = NULL;
  -    while (apr_readdir(d) == APR_SUCCESS) {
  -        const char *d_name;
  -        apr_get_dir_filename(&d_name, d);
  -	p = make_autoindex_entry(d_name, autoindex_opts,
  +    while (apr_dir_read(&dirent, APR_FINFO_DIRENT, thedir) == APR_SUCCESS) {
  +	p = make_autoindex_entry(dirent.name, autoindex_opts,
   				 autoindex_conf, r, keyid, direction);
   	if (p != NULL) {
   	    p->next = head;
  @@ -1647,7 +1645,7 @@
       }
       output_directories(ar, num_ent, autoindex_conf, r, autoindex_opts, keyid,
   		       direction);
  -    apr_closedir(d);
  +    apr_dir_close(thedir);
   
       if (autoindex_opts & FANCY_INDEXING) {
   	ap_rputs("<HR>\n", r);
  
  
  
  1.50      +9 -11     httpd-2.0/modules/mappers/mod_negotiation.c
  
  Index: mod_negotiation.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/modules/mappers/mod_negotiation.c,v
  retrieving revision 1.49
  retrieving revision 1.50
  diff -u -r1.49 -r1.50
  --- mod_negotiation.c	2001/01/20 21:42:19	1.49
  +++ mod_negotiation.c	2001/01/23 04:14:22	1.50
  @@ -912,6 +912,7 @@
       char *filp;
       int prefix_len;
       apr_dir_t *dirp;
  +    apr_finfo_t dirent;
       apr_status_t status;
       struct var_rec mime_info;
       struct accept_rec accept_info;
  @@ -936,17 +937,14 @@
           return HTTP_FORBIDDEN;
       }
   
  -    while (apr_readdir(dirp) == APR_SUCCESS) {
  +    while (apr_dir_read(&dirent, APR_FINFO_DIRENT, dirp) == APR_SUCCESS) {
           request_rec *sub_req;
  -        const char *d_name;
  -
  -        apr_get_dir_filename(&d_name, dirp);
  +        
           /* Do we have a match? */
  -
  -        if (strncmp(d_name, filp, prefix_len)) {
  +        if (strncmp(dirent.name, filp, prefix_len)) {
               continue;
           }
  -        if (d_name[prefix_len] != '.') {
  +        if (dirent.name[prefix_len] != '.') {
               continue;
           }
   
  @@ -955,7 +953,7 @@
            * which we'll be slapping default_type on later).
            */
   
  -        sub_req = ap_sub_req_lookup_file(d_name, r, NULL);
  +        sub_req = ap_sub_req_lookup_file(dirent.name, r, NULL);
   
           /* If it has a handler, we'll pretend it's a CGI script,
            * since that's a good indication of the sort of thing it
  @@ -979,7 +977,7 @@
               ((sub_req->handler) &&
                !strcmp(sub_req->handler, "type-map"))) {
   
  -            apr_closedir(dirp);
  +            apr_dir_close(dirp);
               neg->avail_vars->nelts = 0;
               if (sub_req->status != HTTP_OK) {
                   return sub_req->status;
  @@ -990,7 +988,7 @@
           /* Have reasonable variant --- gather notes. */
   
           mime_info.sub_req = sub_req;
  -        mime_info.file_name = apr_pstrdup(neg->pool, d_name);
  +        mime_info.file_name = apr_pstrdup(neg->pool, dirent.name);
           if (sub_req->content_encoding) {
               mime_info.content_encoding = sub_req->content_encoding;
           }
  @@ -1009,7 +1007,7 @@
           clean_var_rec(&mime_info);
       }
   
  -    apr_closedir(dirp);
  +    apr_dir_close(dirp);
   
       set_vlist_validator(r, r);
   
  
  
  
  1.27      +13 -14    httpd-2.0/modules/mappers/mod_speling.c
  
  Index: mod_speling.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/modules/mappers/mod_speling.c,v
  retrieving revision 1.26
  retrieving revision 1.27
  diff -u -r1.26 -r1.27
  --- mod_speling.c	2001/01/19 07:04:23	1.26
  +++ mod_speling.c	2001/01/23 04:14:23	1.27
  @@ -237,7 +237,7 @@
   {
       spconfig *cfg;
       char *good, *bad, *postgood, *url;
  -    const char *fname;
  +    apr_finfo_t dirent;
       int filoc, dotloc, urlen, pglen;
       apr_array_header_t *candidates = NULL;
       apr_dir_t          *dir;
  @@ -310,8 +310,7 @@
           dotloc = strlen(bad);
       }
   
  -    while (apr_readdir(dir) == APR_SUCCESS &&
  -	   apr_get_dir_filename(&fname, dir) == APR_SUCCESS) {
  +    while (apr_dir_read(&dirent, APR_FINFO_DIRENT, dir) == APR_SUCCESS) {
           sp_reason q;
   
           /*
  @@ -319,8 +318,8 @@
            * requested one, we must have found a broken symlink or some such.
            * Do _not_ try to redirect this, it causes a loop!
            */
  -        if (strcmp(bad, fname) == 0) {
  -            apr_closedir(dir);
  +        if (strcmp(bad, dirent.name) == 0) {
  +            apr_dir_close(dir);
               return OK;
           }
   
  @@ -328,11 +327,11 @@
            * miscapitalization errors are checked first (like, e.g., lower case
            * file, upper case request)
            */
  -        else if (strcasecmp(bad, fname) == 0) {
  +        else if (strcasecmp(bad, dirent.name) == 0) {
               misspelled_file *sp_new;
   
   	    sp_new = (misspelled_file *) apr_push_array(candidates);
  -            sp_new->name = apr_pstrdup(r->pool, fname);
  +            sp_new->name = apr_pstrdup(r->pool, dirent.name);
               sp_new->quality = SP_MISCAPITALIZED;
           }
   
  @@ -340,11 +339,11 @@
            * simple typing errors are checked next (like, e.g.,
            * missing/extra/transposed char)
            */
  -        else if ((q = spdist(bad, fname)) != SP_VERYDIFFERENT) {
  +        else if ((q = spdist(bad, dirent.name)) != SP_VERYDIFFERENT) {
               misspelled_file *sp_new;
   
   	    sp_new = (misspelled_file *) apr_push_array(candidates);
  -            sp_new->name = apr_pstrdup(r->pool, fname);
  +            sp_new->name = apr_pstrdup(r->pool, dirent.name);
               sp_new->quality = q;
           }
   
  @@ -380,23 +379,23 @@
                * (e.g. foo.gif and foo.html) This code will pick the first one
                * it finds. Better than a Not Found, though.
                */
  -            int entloc = ap_ind(fname, '.');
  +            int entloc = ap_ind(dirent.name, '.');
               if (entloc == -1) {
  -                entloc = strlen(fname);
  +                entloc = strlen(dirent.name);
   	    }
   
               if ((dotloc == entloc)
  -                && !strncasecmp(bad, fname, dotloc)) {
  +                && !strncasecmp(bad, dirent.name, dotloc)) {
                   misspelled_file *sp_new;
   
   		sp_new = (misspelled_file *) apr_push_array(candidates);
  -                sp_new->name = apr_pstrdup(r->pool, fname);
  +                sp_new->name = apr_pstrdup(r->pool, dirent.name);
                   sp_new->quality = SP_VERYDIFFERENT;
               }
   #endif
           }
       }
  -    apr_closedir(dir);
  +    apr_dir_close(dir);
   
       if (candidates->nelts != 0) {
           /* Wow... we found us a mispelling. Construct a fixed url */
  
  
  
  1.105     +7 -8      httpd-2.0/server/config.c
  
  Index: config.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/server/config.c,v
  retrieving revision 1.104
  retrieving revision 1.105
  diff -u -r1.104 -r1.105
  --- config.c	2001/01/21 22:14:16	1.104
  +++ config.c	2001/01/23 04:14:24	1.105
  @@ -1280,6 +1280,7 @@
        */
       if (ap_is_rdirectory(ptemp, fname)) {
           apr_dir_t *dirp;
  +        apr_finfo_t dirent;
   	int current;
   	apr_array_header_t *candidates = NULL;
   	fnames *fnew;
  @@ -1300,17 +1301,15 @@
   	    exit(1);
   	}
   	candidates = apr_make_array(p, 1, sizeof(fnames));
  -        while (apr_readdir(dirp) == APR_SUCCESS) {
  -            const char *d_name;
  -	    apr_get_dir_filename(&d_name, dirp);
  -	    /* strip out '.' and '..' */
  -	    if (strcmp(d_name, ".") &&
  -		strcmp(d_name, "..")) {
  +        while (apr_dir_read(&dirent, APR_FINFO_DIRENT, dirp) == APR_SUCCESS) {
  +            /* strip out '.' and '..' */
  +	    if (strcmp(dirent.name, ".") &&
  +		strcmp(dirent.name, "..")) {
   		fnew = (fnames *) apr_push_array(candidates);
  -		fnew->fname = ap_make_full_path(p, fname, d_name);
  +		fnew->fname = ap_make_full_path(p, fname, dirent.name);
   	    }
   	}
  -	apr_closedir(dirp);
  +	apr_dir_close(dirp);
   	if (candidates->nelts != 0) {
               qsort((void *) candidates->elts, candidates->nelts,
                 sizeof(fnames), fname_alphasort);
  
  
  

Mime
View raw message