OpenWrt Forum Archive

Topic: Looking for tiny http server with cgi

The content of this topic has been archived on 19 Apr 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.

Hi,

I am looking for a really small http server to display simple html pages and that allows GET (or POST) just to set nvram variables. It needs to use a tiny amount of space. Can anyone point me to one?

The ability to run a process and send results back to use would be a plusbut not essentual.

Thanks.

You can use the BusyBox built-in httpd server. Supports GET and POST and is included by default in OpenWrt.

I need the web interface to set and reads nvram variables. Can you point me to an example of how to do it and where to put this code on the router? A simple example will go a long way. Sorry if it has been asked before, I can't find it.

Many thanks.

You can just write a shell script named test.sh

#!/bin/sh
nvram get <sample variable>

Then make this file executable chmod +x test.sh and put it in /www/cgi-bin/

(Last edited by RItalMan on 25 Feb 2006, 21:16)

I am using the busybox's httpd to send a specific Myfile.XML file to a client that request the file:
Example:
The client make this request: GET myspecial.xml?WINDWEB_URL=%2Fmyfolder2%2Fmyotherfolder&NUMBER=007
And the servere return the file correctly.

Now it is becoming harder and I need to make it dinamic according to the NUMBER parameter.
Unfortunately I don't have control on the client requests.

I need a server that is able to manage the .xml file in the root (not in /cgi-bin) as CGI request.
It must run on port 80, so I think to move the original httpd in the busybox on port 8080 and this is not a problem.
This server must the specific .XML file with some data changed according the NUMBER parameter.
This server must run only in the local area network.

Anybody can help me?

Regards,
       Cristiano

I posted a patch for busybox-httpd to handle php to the busybox mailing list.  If all you're going to be seeing is that one request for that xml file, it would be trivial to change the httpd code to handle your request - invoke a custom handler on seeing a *.xml request.

All the documentation is in the httpd.c code.

Look in the busybox archives for a patch to httpd to handle php from about 3 months ago.

--Yan

Thank you very much for your answer.
Where is the busybox mailing list?
Does it mean that I need to install php module?

Cris

Google is your friend: busybox.net

You don't need the php module; that's for Apache anyway.  You don't need PHP; what you need is to look at the source code for httpd.c, see how php is handled, and then write an XML handler using the php model as a reference.

--Yan

The discussion might have continued from here.