Quoting Bojan Smojver <[EMAIL PROTECTED]>:

> 2. Make explicit request from jk_fixups (new function)

Actually, this would break Apache completely, because serving requests from
non-handlers is not allowed. However...

I have developed solution for this problem involving this:
-----------------------------------
- declare:

extern module dir_module;

- copy the typedef from mod_dir:

typedef struct dir_config_struct {
    array_header *index_names;
} dir_config_rec;

- introduce jk_fixups function (this runs after jk_translate):
  - this function checks if this is a sub-request, and if yes
  - checks if ForwardDirectories is set, and if yes
  - then it determines if this is the last file mentioned in DirectorIndex
  - if yes and still no worker is set (i.e. we exhausted all index options)
    - sets r->uri=r->main->uri (the directory in question)
    - sets r->finfo.st_mode=S_IFREG, to trick mod_dir to serve
    - sets r->main->handler to JK_HANDLER

- jk_translate gets these changes:
  - if map_uri_to_worker can't find the worker and
  - if r->prev exists and
  - if r->prev->handler is JK_HANDLER and
  - if r->uri is a directory
    - picks the default worker, which then causes the request to go to Tomcat
-----------------------------------

The dirty part is:

- mod_jk would depend on mod_dir being present
- one typedef from mod_dir is copied into mod_jk

I'd like to get comments on this before I commit. I have tested this fix and it
works, but I wouldn't like to introduce a solution that breaks things for some
people or is too ugly. mod_dir is a standard module and it gets compiled in by
default, so I don't think there would be too many people without it. However,
there is always an odd configuration somewhere...

There are also other, minor changes to the code, like making sure that the
structure holding worker_env isn't freed straight after it gets created. We now
need it later to determine the default worker in case we are forwarding directories.

Bojan

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to