[En-Nut-Discussion] MimeHandler questions

Bernd Walter enut at cicely.de
Sun Jun 21 14:04:23 CEST 2009


Lua is doing it's first hello world via cgi interface.
Great thanks for all the people doing the integration.

Now I want something like foo.lua in webroot instead of registering
cgi function(s).
NutSetMimeHandler(".lua", HttpProcessLua);
comes to mind.

With cgi I fill the request args with the following code:
        int i;
        char *name;
        char *value;
        lua_newtable(L);
        int count = NutHttpGetParameterCount(req);
        for (i = 0; i < count; i++) {
                // fill values into lua req;
                name = NutHttpGetParameterName (req, i);
                value = NutHttpGetParameterValue (req, i);
                lua_pushstring(L, name);
                lua_pushstring(L, value);
                lua_settable(L, -3);
        }
        lua_setglobal(L, "args");
It was not used in my hello world test - be aware of bugs.
Can I use NutHttpGet* in a mime handler?

With cgi I send the result with the following code:
        NutHttpSendHeaderTop(stream, req, error, "Ok");
        NutHttpSendHeaderBot(stream, (char*)ctype, -1);
        fputs(page, stream);
The ASP and SSI code makes me believe that this has to be done
differently.
Is modifying the mime type possible at all?

-- 
B.Walter <bernd at bwct.de> http://www.bwct.de
Modbus/TCP Ethernet I/O Baugruppen, ARM basierte FreeBSD Rechner uvm.



More information about the En-Nut-Discussion mailing list