You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by wr...@apache.org on 2009/08/28 09:19:13 UTC
svn commit: r808785 - /httpd/mod_ftp/trunk/modules/ftp/ftp_commands.c
Author: wrowe
Date: Fri Aug 28 07:19:12 2009
New Revision: 808785
URL: http://svn.apache.org/viewvc?rev=808785&view=rev
Log:
Need to collapse _list and _nlst into a single function; to do this
and track the delta, this noop simply reorders _nlst to follow _list
so the initial delta between them is minimal.
Modified:
httpd/mod_ftp/trunk/modules/ftp/ftp_commands.c
Modified: httpd/mod_ftp/trunk/modules/ftp/ftp_commands.c
URL: http://svn.apache.org/viewvc/httpd/mod_ftp/trunk/modules/ftp/ftp_commands.c?rev=808785&r1=808784&r2=808785&view=diff
==============================================================================
--- httpd/mod_ftp/trunk/modules/ftp/ftp_commands.c (original)
+++ httpd/mod_ftp/trunk/modules/ftp/ftp_commands.c Fri Aug 28 07:19:12 2009
@@ -661,7 +661,6 @@
request_rec *rr;
apr_bucket_brigade *bb;
apr_bucket *b;
- int res, decend = 0;
struct ftp_direntry *direntry, *dirp;
char *word, *buf = NULL, *pattern;
int dashl = 0;
@@ -669,6 +668,8 @@
apr_size_t nbytes;
char *varg = apr_pstrdup(r->pool, arg);
const char *test, *sl;
+ int res;
+ int decend = 0;
while (*varg == '-') {
if (ftp_parse2(r->pool, varg, &word, &varg, FTP_KEEP_WHITESPACE)) {
@@ -988,7 +989,6 @@
ftp_server_config *fsc = ftp_get_module_config(r->server->module_config);
conn_rec *cdata;
request_rec *rr;
- int res;
struct ftp_direntry *direntry, *dirp;
apr_bucket_brigade *bb;
apr_bucket *b;
@@ -998,6 +998,7 @@
char *varg = apr_pstrdup(r->pool, arg);
int dashl = 0;
const char *test, *sl;
+ int res;
while (*varg == '-') {
if (ftp_parse2(r->pool, varg, &word, &varg, FTP_KEEP_WHITESPACE)
@@ -1026,12 +1027,12 @@
return res;
}
- /* Run intermediate subrequest to check for a redirect */
+ /* Need to run intermediate subrequest to check for redirect */
rr = ap_sub_req_method_uri(r->method, r->uri, r, NULL);
if (rr->status == HTTP_MOVED_PERMANENTLY) {
ap_parse_uri(r, apr_pstrcat(r->pool, rr->uri, "/", NULL));
- /* Rerun the subrequest */
+ /* Rerun the subrequest with the new uri */
ap_destroy_sub_req(rr);
rr = ap_sub_req_method_uri(r->method, r->uri, r, NULL);
}
@@ -1073,7 +1074,13 @@
bb = apr_brigade_create(r->pool, c->bucket_alloc);
+ /* Print the directory listing, skipping directories if needed */
for (dirp = direntry; dirp; dirp = dirp->next) {
+ if (!(fsc->options & FTP_OPT_NLSTSHOWDIRS)
+ && dirp->modestring[0] == 'd') {
+ continue;
+ }
+
for (test = dirp->name; (sl = ap_strchr_c(test, '/')); test = sl + 1)
/* noop */ ;
@@ -1081,14 +1088,11 @@
continue;
}
- if ((fsc->options & FTP_OPT_NLSTSHOWDIRS) ||
- dirp->modestring[0] != 'd') {
- buf = apr_psprintf(r->pool, "%s" CRLF, dirp->name);
- nbytes = strlen(buf);
- rv = apr_brigade_write(bb, ap_filter_flush,
- cdata->output_filters, buf, nbytes);
- fc->traffic += nbytes;
- }
+ buf = apr_psprintf(r->pool, "%s" CRLF, dirp->name);
+ nbytes = strlen(buf);
+ rv = apr_brigade_write(bb, ap_filter_flush, cdata->output_filters,
+ buf, nbytes);
+ fc->traffic += nbytes;
}
/* If the brigade is empty, just send an eos */