Lighttpd:配置 mod_scgi 不区分大小写

Lighttpd: configure mod_scgi to be case insensitive

我有以下 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" ) )
)

请求时 http://192.168.0.42/infodesk 我得到了正确的 CGI。但是当请求例如http://192.168.0.42/InfoDesk 我收到错误 404。

有什么方法可以将 mod_scgi 配置为不区分大小写吗?

我搜索了 lighttpd 文档和配置,但一无所获。 mod_scgi的源代码阅读和理解是可以的,但是我没有找到处理或比较CGI-URI的行。

感谢任何提示!

好的,我终于解决了。

在lighttpd-1.4.33 source mod_scgi.c(起始行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;
    }
}

strcasecmp() 替换 strncmp() 并删除参数 ct_len.

现在 CGI-URI http://192.168.0.42/infodesk 的处理方式与 http://192.168.0.42/InfoDesk 相同。