Export to GitHub

mongoose - issue #409

compiling mogoose with lua


Posted on Aug 7, 2014 by Swift Lion

I am using mongoose 4.1 api with my c application on an arm based linux system. I was using few python scripts and other cgi scripts by adding the extension as -> "cgi_pattern", ".cgi$|.pl$|**.php$",

Want to use a lua script now just for testing , what are the changes should I make to the mongoose.c or mongoose.h files ?

What is the expected output? What do you see instead? The mongoose should run the lua script instead it just shows the whole script text when I try to run.

What version of the product are you using? On what operating system? mongoose 4.1 running on linux

Please provide any additional information below. I dont run mongoose independently , it is part of my application , i just import mongoose.h and mongoose.c into my project. So how can I also modify it to use lua with mongoose now.

Comment #1

Posted on Aug 7, 2014 by Massive Horse

Are you going to use Lua script as CGI? Is your embedded application commercial or open-source?

Comment #2

Posted on Aug 7, 2014 by Swift Lion

Its open source and doing it for a university project. I want to use lua as CGI

Comment #3

Posted on Aug 7, 2014 by Massive Horse

No change for mongoose is needed. Rename your Lua script to have ".cgi" extension.

Comment #4

Posted on Aug 7, 2014 by Swift Lion

I am using the example script primenumbers.lp just for testing but it gives an error like this

Error 500: Internal Server Error CGI program sent malformed or too big (>16384 bytes) HTTP headers: []

here is the script HTTP/1.0 200 OK Content-Type: text/html

Prime numbers from 0 to 100, calculated by Lua:

for i = 1, 100 do
  if is_prime(i) then mg.write('<span>' .. i .. '</span>&nbsp;') end
end
?>

Reading POST data from Lua (click submit):

   POST data: []
   request method: []
   IP/port: []
   URI: []
   HTTP version []
   HEADERS:
   

Comment #5

Posted on Aug 7, 2014 by Swift Lion

I used the file with extension .cgi also

Status: Fixed

Labels:
Type-Defect Priority-Medium