Summary: | mod_proxy_ftp can't retrieve files with wildcards in their names | ||
---|---|---|---|
Product: | Apache httpd-2 | Reporter: | Dan Poirier <poirier> |
Component: | mod_proxy | Assignee: | Apache HTTPD Bugs Mailing List <bugs> |
Status: | RESOLVED FIXED | ||
Severity: | enhancement | Keywords: | PatchAvailable |
Priority: | P2 | ||
Version: | 2.2.11 | ||
Target Milestone: | --- | ||
Hardware: | All | ||
OS: | All | ||
Attachments: |
Patch to implement the proposed change
Updated patch for trunk |
Created attachment 23412 [details]
Updated patch for trunk
Here's an updated patch, that adds support for files with
wildcards in their names while limiting the changes to
mod_proxy_ftp.c and mod_proxy_ftp.xml.
Applies to trunk, builds without warnings, passes my tests
for the new function.
committed in 758626 with tiny change to add default=on info to ProxyFtpListOnWildcard |
Created attachment 23328 [details] Patch to implement the proposed change We need to be able to serve files whose names contain wildcards using mod_proxy_ftp. Right now, mod_proxy_ftp provides a file listing when it sees wildcards in the filename requested, which is reasonable for interactive browsing of an FTP site. In this case, though, we need to actually get files with those names, and we don't need the browsing function (we already know the filenames). Unfortunately, we don't control the filenames, or we'd just use filenames without wildcards and avoid all this. The solution I'm thinking about is to add a directive to allow selectively disabling the behavior of doing file listings when wildcards are seen in the requested filename. E.g.: The ProxyFtpListOnWildcard directive controls whether wildcard characters ("*?[{~") in requested filenames cause mod_proxy_ftp to return a listing of files instead of downloading a file. By default (value on), they do. Set to "off" to allow downloading files even if they have wildcard characters in their names. (directory context) I'd appreciate comments on this approach, and my proposed implementation (patch against trunk is attached). Also, in testing that change, I found that mod_proxy_ftp escapes wildcards in filenames using backslashes when sending them to the FTP server, which none of the FTP servers I was testing with understood. As I recall, I tried vsftpd, proftpd, and Apache FTP server. To continue with my testing, I added another directive to turn that behavior off, but I'd like to better understand why that behavior is there, since it appears to assume a behavior that my FTP servers don't have, and doesn't seem to be mentioned in RFC 959. From what I know so far, I think this escaping should just be removed. I don't think this escaping could ever have been used before, since any paths with globbing characters in them would have triggered a file listing, which doesn't do the escaping. So until now, Apache would never have tried to retrieve any file with globbing characters in its name. But for now, the attached patch has a directive to control this and leaves the current behavior as the default.