All pastes #749647 Raw Edit

Anonymous

public text v1 · immutable
#749647 ·published 2007-10-25 20:43 UTC
rendered paste body
I added
server.modules              = ("mod_rewrite","mod_magnet","mod_status","mod_expire","mod_access","mod_accesslog")

magnet.attract-physical-path-to = ("/etc/lhttpd/block.lua")

When I go to http://content.imagesocket.com/images/sig4a25.jpg nothing happens, lua file has:


url_check = {
"/images/sig4a25.jpg", -- You could put a timestamp in the comment here.
"/images/foo.jpg",
"/images/baz.jpg",
}


function bad_referer()
    if lighty.request["Referer"] then
        if lighty.request["Referer"] ~= "" then
            -- if not string.match( lighty.request["Referer"], "^http://[^/]*imagesocket\.com/" ) then
             if string.sub( lighty.request["Referer"], 1, 23 ) ~= "http://imagesocket.com/" and
                not string.match( lighty.request["Referer"], "^http://([a-z\-]+\.)imagesocket\.com/" ) then
                return true
            end
        end
    end
    return false
end

-- print( "Processing request for " .. lighty.env["uri.path"] )

for k,v in ipairs(url_check) do
    if lighty.env["uri.path"] == v then
        if bad_referer() then
            -- Bad Referer, set path to warning image
            lighty.env["uri.path"]          = "/limited.gif"
            lighty.env["physical.rel-path"] = lighty.env["uri.path"]
            lighty.env["physical.path"]     = lighty.env["physical.doc-root"] .. lighty.env["physical.rel-path"]
        end
        break
    end
end