Hello,

I've installed lua and luarocks from sources on a CentOS 5.5 and the
following packages from luarocks: cgilua 5.1.4-1, coxpcall 1.13.0-1,
luafilesystem 1.5.0-2, luasql-sqlite3 2.2.0-1, wsapi 1.4-1. I wrote the
following test script:

#!/usr/bin/env /usr/local/bin/cgilua.cgi

local workdir = 'test/'

function writeimg(imgname)
    local file = io.open(workdir..imgname..'.png','rb')

    cgilua.contentheader('image','png')
    repeat
        local buf = file:read(4096)
        if (buf ~= nil) then
            cgilua.put(buf)
        end
    until (buf == nil)
end

local imgname = cgilua.QUERY.image
if (imgname ~= nil) then
    writeimg(imgname)
    return
end

But when I run it form my browser, i get the wrong content type every
time:
Date    Mon, 31 Jan 2011 21:01:27 GMT
Server  Apache/2.2.3 (CentOS)
Vary    Accept-Encoding,User-Agent
Content-Encoding        gzip
Content-Length  24897
Connection      close
Content-Type    text/html; charset=UTF-8

I even trimmed down the script to just one line:
cgilua.contentheader('image','png')
and ran it from console, yet the result stays the same:
# cgilua.cgi test.lua
Status: 200 OK
Content-Length: 0
Content-Type: text/html

If I comment out or the line setting the default value for content type
in wsapi/response.lua or put in some other type I get "text/plain" or
whatever I put there. So it seems contentheader has no effect.

Any hints as to what I'm doing wrong/might be broke?

Thank you,

-- 
thciobanu

_______________________________________________
Kepler-Project mailing list
Kepler-Project@lists.luaforge.net
http://lists.luaforge.net/cgi-bin/mailman/listinfo/kepler-project
http://www.keplerproject.org/

Reply via email to