httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Allasso Travesser <allassopra...@gmail.com>
Subject [users@httpd] Using SetHandler directive breaks default DirectoryIndex
Date Sat, 14 Dec 2013 15:24:00 GMT
Hello,

I created a module with a handler and flagged it using SetHandler directive from within a
Directory entry. When I did this, I observed that the DirectoryIndex directive no longer works.
 i.e., if I have index.html in the site’s root directory, typing the root url gives 404.
 I tried on other modules, and I tried with a module that I stripped down to a skeleton, and
still does the same.  Then I finally discovered that in fact, I can make up an arbitrary SetHandler
entry that doesn’t correspond to any module, and I still get the same effect.

———————

[error] [client xxxxxx] Attempt to serve directory: /home/allasso/public_html/

--------------

configuration:

<Directory /home/allasso/public_html>

 SetHandler dumpheaders-handler

 …
</Directory>

DirectoryIndex index.html index.cgi index.pl index.php index.xhtml index.htm

(note, I also tried adding DirectoryIndex entry inside <Directory /home/allasso/public_html>
but it had no effect)

---------------


FWIW, here is skeleton module:

#include "httpd.h"
#include "http_config.h"
#include "http_main.h"
#include "http_protocol.h"
#include "http_core.h"
#include "http_log.h"

static int handler(request_rec *r)
{
   if (!r->handler || strcmp(r->handler, "dumpheaders-handler")) return (DECLINED);

   ap_set_content_type(r, "text/html");
   ap_rprintf(r, "<p>Dumping headers...</p>\n");

   return OK;
}

static void register_hooks(apr_pool_t *pool)
{
   ap_hook_handler(handler, NULL, NULL, APR_HOOK_FIRST);
}

module AP_MODULE_DECLARE_DATA dumpheaders_module =
{
   STANDARD20_MODULE_STUFF,
   NULL,
   NULL,
   NULL,
   NULL,
   NULL,
   register_hooks,       /* set up other request processing hooks */
};

—————————

But as I said, a module doesn’t even need to exist.

Can anyone shed some light on this behavior?

Thank you kindly,

Allasso Travesser
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Mime
View raw message