Project

General

Profile

Actions

Bug #1164

closed

mod_extforward breaks (at least) URL matching

Added by Anonymous almost 17 years ago. Updated almost 16 years ago.

Status:
Fixed
Priority:
High
Category:
core
Target version:
ASK QUESTIONS IN Forums:

Description

When one loads mod_extforward (no need to set trusted proxies) and then tries to match URLs with regular expressions it always returns false. It is quite possible that not only that is broken but I don't have the time to test it right now.

More info available on request. I reported against core because I can't find that module in the list. Please fix ASAP because it is major problem in my setup. Thanks.

-- kangur

Actions #1

Updated by Anonymous almost 17 years ago

NOT working config:


# lighttpd -pf /etc/lighttpd.d/lists.conf
config {
    var.PID                    = 23909
    var.CWD                    = "/root" 
    var.PORT                   = 30011
    var.HOST                   = "lists.lp.pl" 
    var.USER                   = "lists" 
    var.UID                    = 4011
    var.GROUP                  = "webusers" 
    debug.log-request-handling = "enable" 
    var.BASE_DIR               = "/srv/4011" 
    var.WWW_DIR                = "/srv/4011/www" 
    var.LOG_DIR                = "/srv/4011/log" 
    var.PID_DIR                = "/srv/4011/pid" 
    server.pid-file            = "/srv/4011/pid/lighttpd.pid" 
    server.bind                = "127.0.0.1" 
    server.port                = 30011
    server.document-root       = "/srv/4011/www" 
    server.event-handler       = "linux-sysepoll" 
    server.errorlog            = "/srv/4011/log/error.log" 
    server.username            = "lists" 
    server.groupname           = "webusers" 
    server.modules             = (
        "mod_indexfile",
        "mod_accesslog",
        "mod_extforward",
        "mod_compress",
        "mod_alias",
        "mod_cgi",
        "mod_dirlisting",
        "mod_staticfile",
        # 8
    )
    accesslog.filename         = "/srv/4011/log/access.log" 
    dir-listing.activate       = "disable" 
    index-file.names           = ("index.html", "index.php")
    mimetype.assign            = (
        ".pdf"     => "application/pdf",
        ".sig"     => "application/pgp-signature",
        ".spl"     => "application/futuresplash",
        ".class"   => "application/octet-stream",
        ".ps"      => "application/postscript",
        # 5
        ".torrent" => "application/x-bittorrent",
        ".dvi"     => "application/x-dvi",
        ".gz"      => "application/x-gzip",
        ".pac"     => "application/x-ns-proxy-autoconfig",
        ".swf"     => "application/x-shockwave-flash",
        # 10
        ".tar.gz"  => "application/x-tgz",
        ".tgz"     => "application/x-tgz",
        ".tar"     => "application/x-tar",
        ".zip"     => "application/zip",
        ".mp3"     => "audio/mpeg",
        # 15
        ".m3u"     => "audio/x-mpegurl",
        ".wma"     => "audio/x-ms-wma",
        ".wax"     => "audio/x-ms-wax",
        ".ogg"     => "application/ogg",
        ".wav"     => "audio/x-wav",
        # 20
        ".gif"     => "image/gif",
        ".jpg"     => "image/jpeg",
        ".jpeg"    => "image/jpeg",
        ".png"     => "image/png",
        ".xbm"     => "image/x-xbitmap",
        # 25
        ".xpm"     => "image/x-xpixmap",
        ".xwd"     => "image/x-xwindowdump",
        ".css"     => "text/css",
        ".html"    => "text/html",
        ".htm"     => "text/html",
        # 30
        ".js"      => "text/javascript",
        ".asc"     => "text/plain",
        ".c"       => "text/plain",
        ".h"       => "text/plain",
        ".cc"      => "text/plain",
        # 35
        ".cpp"     => "text/plain",
        ".hh"      => "text/plain",
        ".hpp"     => "text/plain",
        ".conf"    => "text/plain",
        ".log"     => "text/plain",
        # 40
        ".text"    => "text/plain",
        ".txt"     => "text/plain",
        ".diff"    => "text/plain",
        ".patch"   => "text/plain",
        ".ebuild"  => "text/plain",
        # 45
        ".eclass"  => "text/plain",
        ".rtf"     => "application/rtf",
        ".bmp"     => "image/bmp",
        ".tif"     => "image/tiff",
        ".tiff"    => "image/tiff",
        # 50
        ".ico"     => "image/x-icon",
        ".dtd"     => "text/xml",
        ".xml"     => "text/xml",
        ".mpeg"    => "video/mpeg",
        ".mpg"     => "video/mpeg",
        # 55
        ".mov"     => "video/quicktime",
        ".qt"      => "video/quicktime",
        ".avi"     => "video/x-msvideo",
        ".asf"     => "video/x-ms-asf",
        ".asx"     => "video/x-ms-asf",
        # 60
        ".wmv"     => "video/x-ms-wmv",
        ".bz2"     => "application/x-bzip",
        ".tbz"     => "application/x-bzip-compressed-tar",
        ".tar.bz2" => "application/x-bzip-compressed-tar",
        # 64
    )
    extforward.forwarder       = (
        "127.0.0.1" => "trust",
    )
    compress.filetype          = ("text/plain", "text/html", "text/css", "text/javascript", "text/xml")
    alias.url                  = (
        "/mailman"   => "/usr/local/mailman/cgi-bin",
        "/icons"     => "/usr/local/mailman/icons",
        "/pipermail" => "/usr/local/mailman/archives/public",
        # 3
    )

    $HTTP["url"] =~ "^/mailman/" {
        # block 1
        server.indexfiles = ("listinfo")
        cgi.assign        = (
            "" => "",
        )

    } # end of $HTTP["url"] =~ "^/mailman/" 
    else $HTTP["url"] =~ "^/pipermail/" {
        # block 2
        dir-listing.activate      = "enable" 
        dir-listing.hide-dotfiles = "enable" 
        server.follow-symlink     = "enable" 

    } # end of $HTTP["url"] =~ "^/pipermail/" 
}

Logs from using it:


==> /srv/4011/log/access.log <==
87.205.207.250 lists.lp.pl - [16/May/2007:19:10:40 +0200] "GET /mailman/listinfo HTTP/1.0" 200 17349 "-" "Mozilla/5.0 (X11; U; Linux i686; pl; rv:1.8.1.3) Gecko/20070403 BonEcho/2.0.0.3" 

==> /srv/4011/log/error.log <==
2007-05-16 19:10:40: (response.c.205) -- splitting Request-URI
2007-05-16 19:10:40: (response.c.206) Request-URI  :  /mailman/listinfo
2007-05-16 19:10:40: (response.c.207) URI-scheme   :  http
2007-05-16 19:10:40: (response.c.208) URI-authority:  lists.lp.pl
2007-05-16 19:10:40: (response.c.209) URI-path     :  /mailman/listinfo
2007-05-16 19:10:40: (response.c.210) URI-query    :
2007-05-16 19:10:40: (mod_extforward.c.349) -- mod_extforward_uri_handler called
2007-05-16 19:10:40: (mod_extforward.c.405) using address: 87.205.207.250
2007-05-16 19:10:40: (mod_extforward.c.442) patching con->dst_addr_buf for the accesslog: 87.205.207.250
2007-05-16 19:10:40: (response.c.260) -- sanatising URI
2007-05-16 19:10:40: (response.c.261) URI-path     :  /mailman/listinfo
2007-05-16 19:10:40: (response.c.375) -- before doc_root
2007-05-16 19:10:40: (response.c.376) Doc-Root     : /srv/4011/www
2007-05-16 19:10:40: (response.c.377) Rel-Path     : /mailman/listinfo
2007-05-16 19:10:40: (response.c.378) Path         :
2007-05-16 19:10:40: (response.c.426) -- after doc_root
2007-05-16 19:10:40: (response.c.427) Doc-Root     : /srv/4011/www
2007-05-16 19:10:40: (response.c.428) Rel-Path     : /mailman/listinfo
2007-05-16 19:10:40: (response.c.429) Path         : /srv/4011/www/mailman/listinfo
2007-05-16 19:10:40: (response.c.446) -- logical -> physical
2007-05-16 19:10:40: (response.c.447) Doc-Root     : /srv/4011/www
2007-05-16 19:10:40: (response.c.448) Rel-Path     : /mailman/listinfo
2007-05-16 19:10:40: (response.c.449) Path         : /usr/local/mailman/cgi-bin/listinfo
2007-05-16 19:10:40: (response.c.466) -- handling physical path
2007-05-16 19:10:40: (response.c.467) Path         : /usr/local/mailman/cgi-bin/listinfo
2007-05-16 19:10:40: (response.c.474) -- file found
2007-05-16 19:10:40: (response.c.475) Path         : /usr/local/mailman/cgi-bin/listinfo
2007-05-16 19:10:40: (response.c.613) -- handling subrequest
2007-05-16 19:10:40: (response.c.614) Path         : /usr/local/mailman/cgi-bin/listinfo
2007-05-16 19:10:40: (mod_staticfile.c.387) -- handling file as static file
2007-05-16 19:10:40: (response.c.625) -- subrequest finished
2007-05-16 19:10:40: (response.c.205) -- splitting Request-URI
2007-05-16 19:10:40: (response.c.206) Request-URI  :  /favicon.ico
2007-05-16 19:10:40: (response.c.207) URI-scheme   :  http
2007-05-16 19:10:40: (response.c.208) URI-authority:  lists.lp.pl
2007-05-16 19:10:40: (response.c.209) URI-path     :  /favicon.ico
2007-05-16 19:10:40: (response.c.210) URI-query    :
2007-05-16 19:10:40: (mod_extforward.c.349) -- mod_extforward_uri_handler called
2007-05-16 19:10:40: (mod_extforward.c.405) using address: 87.205.207.250
2007-05-16 19:10:40: (mod_extforward.c.442) patching con->dst_addr_buf for the accesslog: 87.205.207.250
2007-05-16 19:10:40: (response.c.260) -- sanatising URI
2007-05-16 19:10:40: (response.c.261) URI-path     :  /favicon.ico
2007-05-16 19:10:40: (response.c.375) -- before doc_root
2007-05-16 19:10:40: (response.c.376) Doc-Root     : /srv/4011/www
2007-05-16 19:10:40: (response.c.377) Rel-Path     : /favicon.ico
2007-05-16 19:10:40: (response.c.378) Path         :
2007-05-16 19:10:40: (response.c.426) -- after doc_root
2007-05-16 19:10:40: (response.c.427) Doc-Root     : /srv/4011/www
2007-05-16 19:10:40: (response.c.428) Rel-Path     : /favicon.ico
2007-05-16 19:10:40: (response.c.429) Path         : /srv/4011/www/favicon.ico
2007-05-16 19:10:40: (response.c.446) -- logical -> physical
2007-05-16 19:10:40: (response.c.447) Doc-Root     : /srv/4011/www
2007-05-16 19:10:40: (response.c.448) Rel-Path     : /favicon.ico
2007-05-16 19:10:40: (response.c.449) Path         : /srv/4011/www/favicon.ico
2007-05-16 19:10:40: (response.c.466) -- handling physical path
2007-05-16 19:10:40: (response.c.467) Path         : /srv/4011/www/favicon.ico
2007-05-16 19:10:40: (response.c.523) -- file not found
2007-05-16 19:10:40: (response.c.524) Path         : /srv/4011/www/favicon.ico
2007-05-16 19:10:40: (response.c.205) -- splitting Request-URI
2007-05-16 19:10:40: (response.c.206) Request-URI  :  /favicon.ico
2007-05-16 19:10:40: (response.c.207) URI-scheme   :  http
2007-05-16 19:10:40: (response.c.208) URI-authority:  lists.lp.pl
2007-05-16 19:10:40: (response.c.209) URI-path     :  /favicon.ico
2007-05-16 19:10:40: (response.c.210) URI-query    :
2007-05-16 19:10:40: (mod_extforward.c.349) -- mod_extforward_uri_handler called
2007-05-16 19:10:40: (mod_extforward.c.405) using address: 87.205.207.250
2007-05-16 19:10:40: (mod_extforward.c.442) patching con->dst_addr_buf for the accesslog: 87.205.207.250
2007-05-16 19:10:40: (response.c.260) -- sanatising URI
2007-05-16 19:10:40: (response.c.261) URI-path     :  /favicon.ico
2007-05-16 19:10:40: (response.c.375) -- before doc_root
2007-05-16 19:10:40: (response.c.376) Doc-Root     : /srv/4011/www
2007-05-16 19:10:40: (response.c.377) Rel-Path     : /favicon.ico
2007-05-16 19:10:40: (response.c.378) Path         :
2007-05-16 19:10:40: (response.c.426) -- after doc_root
2007-05-16 19:10:40: (response.c.427) Doc-Root     : /srv/4011/www
2007-05-16 19:10:40: (response.c.428) Rel-Path     : /favicon.ico
2007-05-16 19:10:40: (response.c.429) Path         : /srv/4011/www/favicon.ico
2007-05-16 19:10:40: (response.c.446) -- logical -> physical
2007-05-16 19:10:40: (response.c.447) Doc-Root     : /srv/4011/www
2007-05-16 19:10:40: (response.c.448) Rel-Path     : /favicon.ico
2007-05-16 19:10:40: (response.c.449) Path         : /srv/4011/www/favicon.ico
2007-05-16 19:10:40: (response.c.466) -- handling physical path
2007-05-16 19:10:40: (response.c.467) Path         : /srv/4011/www/favicon.ico
2007-05-16 19:10:40: (response.c.523) -- file not found
2007-05-16 19:10:40: (response.c.524) Path         : /srv/4011/www/favicon.ico

-- kangur

Actions #2

Updated by Anonymous almost 17 years ago

Working config (without mod_extforward):


# lighttpd -pf /etc/lighttpd.d/lists.conf
config {
    var.PID                    = 27659
    var.CWD                    = "/root" 
    var.PORT                   = 30011
    var.HOST                   = "lists.lp.pl" 
    var.USER                   = "lists" 
    var.UID                    = 4011
    var.GROUP                  = "webusers" 
    debug.log-request-handling = "enable" 
    var.BASE_DIR               = "/srv/4011" 
    var.WWW_DIR                = "/srv/4011/www" 
    var.LOG_DIR                = "/srv/4011/log" 
    var.PID_DIR                = "/srv/4011/pid" 
    server.pid-file            = "/srv/4011/pid/lighttpd.pid" 
    server.bind                = "127.0.0.1" 
    server.port                = 30011
    server.document-root       = "/srv/4011/www" 
    server.event-handler       = "linux-sysepoll" 
    server.errorlog            = "/srv/4011/log/error.log" 
    server.username            = "lists" 
    server.groupname           = "webusers" 
    server.modules             = (
        "mod_indexfile",
        "mod_accesslog",
        "mod_compress",
        "mod_alias",
        "mod_cgi",
        "mod_dirlisting",
        "mod_staticfile",
        # 7
    )
    accesslog.filename         = "/srv/4011/log/access.log" 
    dir-listing.activate       = "disable" 
    index-file.names           = ("index.html", "index.php")
    mimetype.assign            = (
        ".pdf"     => "application/pdf",
        ".sig"     => "application/pgp-signature",
        ".spl"     => "application/futuresplash",
        ".class"   => "application/octet-stream",
        ".ps"      => "application/postscript",
        # 5
        ".torrent" => "application/x-bittorrent",
        ".dvi"     => "application/x-dvi",
        ".gz"      => "application/x-gzip",
        ".pac"     => "application/x-ns-proxy-autoconfig",
        ".swf"     => "application/x-shockwave-flash",
        # 10
        ".tar.gz"  => "application/x-tgz",
        ".tgz"     => "application/x-tgz",
        ".tar"     => "application/x-tar",
        ".zip"     => "application/zip",
        ".mp3"     => "audio/mpeg",
        # 15
        ".m3u"     => "audio/x-mpegurl",
        ".wma"     => "audio/x-ms-wma",
        ".wax"     => "audio/x-ms-wax",
        ".ogg"     => "application/ogg",
        ".wav"     => "audio/x-wav",
        # 20
        ".gif"     => "image/gif",
        ".jpg"     => "image/jpeg",
        ".jpeg"    => "image/jpeg",
        ".png"     => "image/png",
        ".xbm"     => "image/x-xbitmap",
        # 25
        ".xpm"     => "image/x-xpixmap",
        ".xwd"     => "image/x-xwindowdump",
        ".css"     => "text/css",
        ".html"    => "text/html",
        ".htm"     => "text/html",
        # 30
        ".js"      => "text/javascript",
        ".asc"     => "text/plain",
        ".c"       => "text/plain",
        ".h"       => "text/plain",
        ".cc"      => "text/plain",
        # 35
        ".cpp"     => "text/plain",
        ".hh"      => "text/plain",
        ".hpp"     => "text/plain",
        ".conf"    => "text/plain",
        ".log"     => "text/plain",
        # 40
        ".text"    => "text/plain",
        ".txt"     => "text/plain",
        ".diff"    => "text/plain",
        ".patch"   => "text/plain",
        ".ebuild"  => "text/plain",
        # 45
        ".eclass"  => "text/plain",
        ".rtf"     => "application/rtf",
        ".bmp"     => "image/bmp",
        ".tif"     => "image/tiff",
        ".tiff"    => "image/tiff",
        # 50
        ".ico"     => "image/x-icon",
        ".dtd"     => "text/xml",
        ".xml"     => "text/xml",
        ".mpeg"    => "video/mpeg",
        ".mpg"     => "video/mpeg",
        # 55
        ".mov"     => "video/quicktime",
        ".qt"      => "video/quicktime",
        ".avi"     => "video/x-msvideo",
        ".asf"     => "video/x-ms-asf",
        ".asx"     => "video/x-ms-asf",
        # 60
        ".wmv"     => "video/x-ms-wmv",
        ".bz2"     => "application/x-bzip",
        ".tbz"     => "application/x-bzip-compressed-tar",
        ".tar.bz2" => "application/x-bzip-compressed-tar",
        # 64
    )
    compress.filetype          = ("text/plain", "text/html", "text/css", "text/javascript", "text/xml")
    alias.url                  = (
        "/mailman"   => "/usr/local/mailman/cgi-bin",
        "/icons"     => "/usr/local/mailman/icons",
        "/pipermail" => "/usr/local/mailman/archives/public",
        # 3
    )

    $HTTP["url"] =~ "^/mailman/" {
        # block 1
        server.indexfiles = ("listinfo")
        cgi.assign        = (
            "" => "",
        )

    } # end of $HTTP["url"] =~ "^/mailman/" 
    else $HTTP["url"] =~ "^/pipermail/" {
        # block 2
        dir-listing.activate      = "enable" 
        dir-listing.hide-dotfiles = "enable" 
        server.follow-symlink     = "enable" 

    } # end of $HTTP["url"] =~ "^/pipermail/" 
}

Logs from using it:


==> /srv/4011/log/error.log <==
2007-05-16 19:10:40: (response.c.446) -- logical -> physical
2007-05-16 19:10:40: (response.c.447) Doc-Root     : /srv/4011/www
2007-05-16 19:10:40: (response.c.448) Rel-Path     : /favicon.ico
2007-05-16 19:10:40: (response.c.449) Path         : /srv/4011/www/favicon.ico
2007-05-16 19:10:40: (response.c.466) -- handling physical path
2007-05-16 19:10:40: (response.c.467) Path         : /srv/4011/www/favicon.ico
2007-05-16 19:10:40: (response.c.523) -- file not found
2007-05-16 19:10:40: (response.c.524) Path         : /srv/4011/www/favicon.ico
2007-05-16 19:12:57: (log.c.196) server stopped
2007-05-16 19:14:01: (log.c.136) server started
2007-05-16 19:14:10: (response.c.205) -- splitting Request-URI
2007-05-16 19:14:10: (response.c.206) Request-URI  :  /mailman/listinfo
2007-05-16 19:14:10: (response.c.207) URI-scheme   :  http
2007-05-16 19:14:10: (response.c.208) URI-authority:  lists.lp.pl
2007-05-16 19:14:10: (response.c.209) URI-path     :  /mailman/listinfo
2007-05-16 19:14:10: (response.c.210) URI-query    :
2007-05-16 19:14:10: (response.c.260) -- sanatising URI
2007-05-16 19:14:10: (response.c.261) URI-path     :  /mailman/listinfo
2007-05-16 19:14:10: (response.c.375) -- before doc_root
2007-05-16 19:14:10: (response.c.376) Doc-Root     : /srv/4011/www
2007-05-16 19:14:10: (response.c.377) Rel-Path     : /mailman/listinfo
2007-05-16 19:14:10: (response.c.378) Path         :
2007-05-16 19:14:10: (response.c.426) -- after doc_root
2007-05-16 19:14:10: (response.c.427) Doc-Root     : /srv/4011/www
2007-05-16 19:14:10: (response.c.428) Rel-Path     : /mailman/listinfo
2007-05-16 19:14:10: (response.c.429) Path         : /srv/4011/www/mailman/listinfo
2007-05-16 19:14:10: (response.c.446) -- logical -> physical
2007-05-16 19:14:10: (response.c.447) Doc-Root     : /srv/4011/www
2007-05-16 19:14:10: (response.c.448) Rel-Path     : /mailman/listinfo
2007-05-16 19:14:10: (response.c.449) Path         : /usr/local/mailman/cgi-bin/listinfo
2007-05-16 19:14:10: (response.c.466) -- handling physical path
2007-05-16 19:14:10: (response.c.467) Path         : /usr/local/mailman/cgi-bin/listinfo
2007-05-16 19:14:10: (response.c.474) -- file found
2007-05-16 19:14:10: (response.c.475) Path         : /usr/local/mailman/cgi-bin/listinfo
2007-05-16 19:14:10: (response.c.613) -- handling subrequest
2007-05-16 19:14:10: (response.c.614) Path         : /usr/local/mailman/cgi-bin/listinfo

==> /srv/4011/log/access.log <==
127.0.0.1 lists.lp.pl - [16/May/2007:19:14:10 +0200] "GET /mailman/listinfo HTTP/1.0" 200 2000 "-" "Mozilla/5.0 (X11; U; Linux i686; pl; rv:1.8.1.3) Gecko/20070403 BonEcho/2.0.0.3" 

-- kangur

Actions #3

Updated by ts77 almost 17 years ago

Thats currently a showstopper for me too.
Any progress or ideas about it?

Actions #4

Updated by blueyed over 16 years ago

I can confirm this.

Using an empty url match ($HTTPurl =~ "") works, but will always match.

I've actually traced it down before finding this bug report and here's the config I came up with to reproduce it:


server.modules = (
    "mod_extforward",
    "mod_access",
)
server.document-root           = "/var/www" 
server.port                    = 888

index-file.names = ("index.html")

$HTTP["url"] =~ "index" {
        url.access-deny  = ("")
}

Requesting http://localhost:888/index.html will be OK in this case, unless you remove mod_extforward.

I'm using 1.4.16-2ubuntu1.

My workaround was to use subdomains instead of subdirectories for this particular project.

Actions #5

Updated by ts77 over 16 years ago

it shows in 1.4.16 too, bumping version-flag.

Actions #6

Updated by Anonymous over 16 years ago

can you please please please fix this issue... it's the most annoying of the bugs right now.

Actions #8

Updated by Anonymous over 16 years ago

lighttpd-1.4.17.r1956.tar.gz - still doesn't work for me

-- misiolap

Actions #9

Updated by Anonymous over 16 years ago

yep, doesn't work for me either. please fix this bug, it's killing me.. :(

-- cahe

Actions #10

Updated by Anonymous over 16 years ago

Replying to cahe:

yep, doesn't work for me either. please fix this bug, it's killing me.. :(

we've done some further testing and it seems, that the fix works, but only once - i thought it was my browsers cache, but after testing it with curl i'm quite sure, on 1.4.17, when the page is requested for the first time, the $HTTPurl conditional works fine, but afterwards it breaks and doesn't work at all.

it's an improvement! ;-)

-- cahe

Actions #11

Updated by Anonymous over 16 years ago

Okey... the patch provided by darix SHOULD solve the problem - it doesn't let lighty to cache conditionals UNTIL URL is parsed. by why does it work only one time and then collapses? no idea. if somebody solves this question we're there - otherwise it's business as usual.

-- cahe&misolap

Actions #12

Updated by Anonymous over 16 years ago

lighttpd seems to alloc few connection structures on first connection, and then re-uses it - without resetting connection.conditional_is_valid

Patch for darix version:

--- response.c.old 2007-04-13 22:47:40.000000000 0200
++ response.c 2007-08-29 13:36:30.000000000 +0200
@ -136,8 +136,13 @
/* no decision yet, build conf->filename */
if (con->mode DIRECT && con->physical.path->used 0) {
char *qstr;

+ size_t i;
+ for(i = 0; i < COMP_LAST_ELEMENT; +i) {
con->conditional_is_validi = 0;
+ }
+
/* we only come here when we have the parse the full request again
  • a HANDLER_COMEBACK from mod_rewrite and mod_fastcgi might be a
  • problem here as mod_setenv might get called multiple times

-- Misiolap

Actions #13

Updated by Anonymous over 16 years ago

Sorry for posting rubbish. re-posting patch:


--- response.c.old      2007-04-13 22:47:40.000000000 +0200
+++ response.c  2007-08-29 13:36:30.000000000 +0200
@@ -136,8 +136,13 @@
        /* no decision yet, build conf->filename */
        if (con->mode == DIRECT && con->physical.path->used == 0) {
                char *qstr;

+               size_t i;
+               for(i = 0; i < COMP_LAST_ELEMENT; ++i) {
+                       con->conditional_is_valid[i] = 0;
+               }
+
                /* we only come here when we have the parse the full request again
                 *
                 * a HANDLER_COMEBACK from mod_rewrite and mod_fastcgi might be a
                 * problem here as mod_setenv might get called multiple times

-- Misiolap

Actions #14

Updated by Anonymous over 16 years ago

it fucking works :D

Actions #15

Updated by ts77 over 16 years ago

too bad that the final fix didn't make it in 1.4.17 :(

Actions #16

Updated by Anonymous over 16 years ago

Looks like some mistake or spam with the attachment above...

Anyway: '''Could some lighttpd dev please review, sanity-check and commit that patch? Or at least tell us why it is wrong... Or anything... Thanks!'''

This bug has 4 months and it is a major PITA for many setups.

-- kangur

Actions #17

Updated by Anonymous over 16 years ago

Replying to :

Working config (without mod_extforward):

{{{
  1. lighttpd -pf /etc/lighttpd.d/lists.conf
    config {
    var.PID = 27659
    var.CWD = "/root"
    var.PORT = 30011
    var.HOST = "lists.lp.pl"
    var.USER = "lists"
    var.UID = 4011
    var.GROUP = "webusers"
    debug.log-request-handling = "enable"
    var.BASE_DIR = "/srv/4011"
    var.WWW_DIR = "/srv/4011/www"
    var.LOG_DIR = "/srv/4011/log"
    var.PID_DIR = "/srv/4011/pid"
    server.pid-file = "/srv/4011/pid/lighttpd.pid"
    server.bind = "127.0.0.1"
    server.port = 30011
    server.document-root = "/srv/4011/www"
    server.event-handler = "linux-sysepoll"
    server.errorlog = "/srv/4011/log/error.log"
    server.username = "lists"
    server.groupname = "webusers"
    server.modules = (
    "mod_indexfile",
    "mod_accesslog",
    "mod_compress",
    "mod_alias",
    "mod_cgi",
    "mod_dirlisting",
    "mod_staticfile",
  2. 7
    )
    accesslog.filename = "/srv/4011/log/access.log"
    dir-listing.activate = "disable"
    index-file.names = ("index.html", "index.php")
    mimetype.assign = (
    ".pdf" => "application/pdf",
    ".sig" => "application/pgp-signature",
    ".spl" => "application/futuresplash",
    ".class" => "application/octet-stream",
    ".ps" => "application/postscript",
  3. 5
    ".torrent" => "application/x-bittorrent",
    ".dvi" => "application/x-dvi",
    ".gz" => "application/x-gzip",
    ".pac" => "application/x-ns-proxy-autoconfig",
    ".swf" => "application/x-shockwave-flash",
  4. 10
    ".tar.gz" => "application/x-tgz",
    ".tgz" => "application/x-tgz",
    ".tar" => "application/x-tar",
    ".zip" => "application/zip",
    ".mp3" => "audio/mpeg",
  5. 15
    ".m3u" => "audio/x-mpegurl",
    ".wma" => "audio/x-ms-wma",
    ".wax" => "audio/x-ms-wax",
    ".ogg" => "application/ogg",
    ".wav" => "audio/x-wav",
  6. 20
    ".gif" => "image/gif",
    ".jpg" => "image/jpeg",
    ".jpeg" => "image/jpeg",
    ".png" => "image/png",
    ".xbm" => "image/x-xbitmap",
  7. 25
    ".xpm" => "image/x-xpixmap",
    ".xwd" => "image/x-xwindowdump",
    ".css" => "text/css",
    ".html" => "text/html",
    ".htm" => "text/html",
  8. 30
    ".js" => "text/javascript",
    ".asc" => "text/plain",
    ".c" => "text/plain",
    ".h" => "text/plain",
    ".cc" => "text/plain",
  9. 35
    ".cpp" => "text/plain",
    ".hh" => "text/plain",
    ".hpp" => "text/plain",
    ".conf" => "text/plain",
    ".log" => "text/plain",
  10. 40
    ".text" => "text/plain",
    ".txt" => "text/plain",
    ".diff" => "text/plain",
    ".patch" => "text/plain",
    ".ebuild" => "text/plain",
  11. 45
    ".eclass" => "text/plain",
    ".rtf" => "application/rtf",
    ".bmp" => "image/bmp",
    ".tif" => "image/tiff",
    ".tiff" => "image/tiff",
  12. 50
    ".ico" => "image/x-icon",
    ".dtd" => "text/xml",
    ".xml" => "text/xml",
    ".mpeg" => "video/mpeg",
    ".mpg" => "video/mpeg",
  13. 55
    ".mov" => "video/quicktime",
    ".qt" => "video/quicktime",
    ".avi" => "video/x-msvideo",
    ".asf" => "video/x-ms-asf",
    ".asx" => "video/x-ms-asf",
  14. 60
    ".wmv" => "video/x-ms-wmv",
    ".bz2" => "application/x-bzip",
    ".tbz" => "application/x-bzip-compressed-tar",
    ".tar.bz2" => "application/x-bzip-compressed-tar",
  15. 64
    )
    compress.filetype = ("text/plain", "text/html", "text/css", "text/javascript", "text/xml")
    alias.url = (
    "/mailman" => "/usr/local/mailman/cgi-bin",
    "/icons" => "/usr/local/mailman/icons",
    "/pipermail" => "/usr/local/mailman/archives/public",
  16. 3
    )
$HTTPurl =~ "^/mailman/" {
  1. block 1
    server.indexfiles = ("listinfo")
    cgi.assign = (
    "" => "",
    )
} # end of $HTTPurl =~ "^/mailman/"
else $HTTPurl =~ "^/pipermail/" {
  1. block 2
    dir-listing.activate = "enable"
    dir-listing.hide-dotfiles = "enable"
    server.follow-symlink = "enable"

} # end of $HTTPurl =~ "^/pipermail/"
}
}}}

Logs from using it:

{{{
> /srv/4011/log/error.log <
2007-05-16 19:10:40: (response.c.446) -- logical > physical
2007-05-16 19:10:40: (response.c.447) Doc-Root : /srv/4011/www
2007-05-16 19:10:40: (response.c.448) Rel-Path : /favicon.ico
2007-05-16 19:10:40: (response.c.449) Path : /srv/4011/www/favicon.ico
2007-05-16 19:10:40: (response.c.466) -
handling physical path
2007-05-16 19:10:40: (response.c.467) Path : /srv/4011/www/favicon.ico
2007-05-16 19:10:40: (response.c.523) -- file not found
2007-05-16 19:10:40: (response.c.524) Path : /srv/4011/www/favicon.ico
2007-05-16 19:12:57: (log.c.196) server stopped
2007-05-16 19:14:01: (log.c.136) server started
2007-05-16 19:14:10: (response.c.205) -- splitting Request-URI
2007-05-16 19:14:10: (response.c.206) Request-URI : /mailman/listinfo
2007-05-16 19:14:10: (response.c.207) URI-scheme : http
2007-05-16 19:14:10: (response.c.208) URI-authority: lists.lp.pl
2007-05-16 19:14:10: (response.c.209) URI-path : /mailman/listinfo
2007-05-16 19:14:10: (response.c.210) URI-query :
2007-05-16 19:14:10: (response.c.260) -- sanatising URI
2007-05-16 19:14:10: (response.c.261) URI-path : /mailman/listinfo
2007-05-16 19:14:10: (response.c.375) -- before doc_root
2007-05-16 19:14:10: (response.c.376) Doc-Root : /srv/4011/www
2007-05-16 19:14:10: (response.c.377) Rel-Path : /mailman/listinfo
2007-05-16 19:14:10: (response.c.378) Path :
2007-05-16 19:14:10: (response.c.426) -- after doc_root
2007-05-16 19:14:10: (response.c.427) Doc-Root : /srv/4011/www
2007-05-16 19:14:10: (response.c.428) Rel-Path : /mailman/listinfo
2007-05-16 19:14:10: (response.c.429) Path : /srv/4011/www/mailman/listinfo
2007-05-16 19:14:10: (response.c.446) -- logical > physical
2007-05-16 19:14:10: (response.c.447) Doc-Root : /srv/4011/www
2007-05-16 19:14:10: (response.c.448) Rel-Path : /mailman/listinfo
2007-05-16 19:14:10: (response.c.449) Path : /usr/local/mailman/cgi-bin/listinfo
2007-05-16 19:14:10: (response.c.466) -
handling physical path
2007-05-16 19:14:10: (response.c.467) Path : /usr/local/mailman/cgi-bin/listinfo
2007-05-16 19:14:10: (response.c.474) -- file found
2007-05-16 19:14:10: (response.c.475) Path : /usr/local/mailman/cgi-bin/listinfo
2007-05-16 19:14:10: (response.c.613) -- handling subrequest
2007-05-16 19:14:10: (response.c.614) Path : /usr/local/mailman/cgi-bin/listinfo

> /srv/4011/log/access.log <
127.0.0.1 lists.lp.pl - +0200 "GET /mailman/listinfo HTTP/1.0" 200 2000 "-" "Mozilla/5.0 (X11; U; Linux i686; pl; rv:1.8.1.3) Gecko/20070403 BonEcho/2.0.0.3"
}}}
Actions #18

Updated by Anonymous over 16 years ago

FreeBSD 6.2, Lighttpd 1.4.18, bug confirmed. Please, if some one have patch for this - post it somewhere.

-- alexxwiz

Actions #19

Updated by Anonymous over 16 years ago

The patch is in comments above.

Actions #20

Updated by Anonymous over 16 years ago

This bug may be linked to (or even be a duplicate of?) #738

-- lionel

Actions #21

Updated by Anonymous over 16 years ago

It's also the same as #495

Actions #22

Updated by stbuehler about 16 years ago

I think that should do it (it is basically the same thing as the patch from Misiolap, but uses an already existing function):


--- a/src/connections.c
+++ b/src/connections.c
@@ -834,14 +834,8 @@ int connection_reset(server *srv, connection *con) {
         con->plugin_ctx[pd->id] = NULL;
     }

-#if COND_RESULT_UNSET
-    for (i = srv->config_context->used - 1; i >= 0; i --) {
-        con->cond_cache[i].result = COND_RESULT_UNSET;
-        con->cond_cache[i].patterncount = 0;
-    }
-#else
-    memset(con->cond_cache, 0, sizeof(cond_cache_t) * srv->config_context->used);
-#endif
+    /* The cond_cache gets reset in response.c */
+//    config_cond_cache_reset(srv, con);

 #ifdef USE_OPENSSL
     if (con->ssl_error_want_reuse_buffer) {
--- a/src/response.c
+++ b/src/response.c
@@ -150,6 +150,8 @@ handler_t http_response_prepare(server *srv, connection *con) {
          *
          *  */

+        config_cond_cache_reset(srv, con);
+
         if (con->conf.log_condition_handling) {
             log_error_write(srv, __FILE__, __LINE__,  "s",  "run condition");
         }
Actions #23

Updated by stbuehler about 16 years ago

  • Status changed from New to Fixed
  • Resolution set to fixed

Fixed in r2080

Actions

Also available in: Atom