首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Lighttpd:将mod_scgi配置为不区分大小写

Lighttpd:将mod_scgi配置为不区分大小写
EN

Stack Overflow用户
提问于 2015-04-27 11:06:02
回答 1查看 397关注 0票数 0

我有下面的lighttpd.conf

代码语言:javascript
复制
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是手动或比较的。

谢谢你的提示!

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2015-04-29 14:27:37

好了,我终于解决了。

在Lightttpd-1.4.33源mod_scgi.c中(开始行2715):

代码语言:javascript
复制
/* 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;
    }
}

strncmp()替换为strcasecmp()并删除param ct_len

现在,CGI-URI http://192.168.0.42/infodesk将与http://192.168.0.42/InfoDesk一样处理。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/29894020

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档