I have the following lighttpd.conf
:
server.document-root = "/var/www/root"
server.modules = ( "mod_scgi" )
server.port = 80
server.username = "www"
server.groupname = "www"
mimetype.assign = (
".htm" => "text/html",
".html" => "text/html",
".txt" => "text/plain",
".jpg" => "image/jpeg",
".png" => "image/png",
".myfile" => "text/html",
".zhtml" => "text/html"
)
index-file.names = ( "index.html" )
server.protocol-http11 = "enable"
server.error-handler-404 = "/error-404.php"
scgi.server = (
"/infodesk" => ( "127.0.0.1" => ( "host" => "127.0.0.1", "port" => 9123, "fix-root-scriptname" => "enable", "check-local" => "disable" ) )
)
When requesting http://192.168.0.42/infodesk
I get the correct CGI. But when requesting e.g. http://192.168.0.42/InfoDesk
I get an Error 404.
Is there any way to configure mod_scgi to be case insensitive?
I searched the lighttpd docs and configurations but couldn't find a thing. The source code of mod_scgi is ok to read and understand, but I didn't find a line where the CGI-URI is handlend or compared or so.
Thanks for any hints!
Ok, finally I solved it.
In lighttpd-1.4.33 source mod_scgi.c
(beginning line 2715):
/* check if extension matches */
for (k = 0; k < p->conf.exts->used; k++) {
size_t ct_len;
scgi_extension *ext = p->conf.exts->exts[k];
if (ext->key->used == 0) continue;
ct_len = ext->key->used - 1;
if (s_len < ct_len) continue;
/* check extension in the form "/scgi_pattern" */
if (*(ext->key->ptr) == '/') {
if (strncmp(fn->ptr, ext->key->ptr, ct_len) == 0) {
extension = ext;
break;
}
} else if (0 == strncmp(fn->ptr + s_len - ct_len, ext->key->ptr, ct_len)) {
/* check extension in the form ".fcg" */
extension = ext;
break;
}
}
replace the strncmp()
with a strcasecmp()
and delete param ct_len
.
Now the CGI-URI http://192.168.0.42/infodesk
will be handled the same as http://192.168.0.42/InfoDesk
.