Linux - SoftwareThis forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
The mod_autoindex directives can be used in a per directory basis either in httpd.cond or through .htaccess.
I don't know what you've changed to create your custom autoindex module, but you should create custom directives in the modified module and use them to do what you're trying to do.
I stripped a bunch of useless stuff out and changed the HTML.
I did change the options directives so they don't overlap with autoindex.
More or less, I think the problem is I'm not sure how the "Options +Indexes" part of the httpd config is handled.
If I enable Options +Indexes, autoindex takes over. If I don't, I get a 403.
I need to know how to "enable" the module for that folder I believe.
Edit: Some code
Code:
if (allow_opts & OPT_INDEXES) {
int errstatus;
if ((errstatus = ap_discard_request_body(r)) != OK) {
return errstatus;
}
if (r->filename[strlen(r->filename) - 1] != '/') {
r->filename = apr_pstrcat(r->pool, r->filename, "/", NULL);
}
return index_directory(r, d);
} else {
ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, "Directory index forbidden by Options directive: %s", r->filename);
return HTTP_FORBIDDEN;
}
That code is the same in autoindex and customindex. I can't change the OPT_INDEXES to anything else or I get the usual "error: 'OPT_INDEXES2' undeclared (first use in this function)" There's no other instance of OPT_INDEXES anywhere else in the file, so I have no idea where I'd have to define a new variable.
Code:
<Directory /var/www/test/>
Options Indexes
MediaIndexOptions MinNameWidth=24 MaxNameWidth=128
Order allow,deny
allow from all
</Directory>
This needs to work without having to recompile apache itself.
Last edited by jmoschetti45; 11-06-2010 at 09:55 PM.
Does apache refuse to start complaining about MediaIndexOptions?
If not, then the directive is recognized (meaning that it uses your custom autoindex).
If the result is not what you expect it to be, then you should review your changes in the code.
I think the problem has been narrowed down to the fact that autoindex runs before customindex.
I've tried simply compiling a second copy of autoindex with only 2 changes in the HTML to see if it would pull up, and it wont. Is there some way to set the order of the modules loaded? Or am I off on the wrong track?
If I replace mod_autoindex.so with a renamed version of mod_customindex.so it works fine, but then I lose the original entirely.
I think that you're indeed on the wrong track.
This has nothing to do with the order modules are loaded, since you use custom directives that are available only in your custom modules. When apache encounters these directives it will use your module to parse the resulting page regardless of the modules order.
FYI apache loads the modules in the order of the LoadModule directives that exist in httpd.conf, so you can load your module before the default autoindex.so, but it's not going to work for the reason explained above.
If you want to customize the resulting html, better take a look here
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.