Remove All Ads from XDA
Honor View 10

[APP] micro-httpd (GET / POST / CGI support) cross-compiled to Android

419 posts
Thanks Meter: 405
By viulian, Inactive Recognized Developer on 28th August 2011, 03:42 PM
Post Reply Email Thread

A while ago I've managed to cross-compile a basic web server, resulting in a native ARM executable (you can find it here) that allows any other device to connect to port 80 (or whatever) and browse the contents of the phone.
Easy to exchange photos at a cafeteria which has wifi and both phones are connected - for example. No need for an FTP client, slow bluetooth, and so on...

However, I wanted more and since webserver was only handling GET (no POST / no CGI), I've started looking for an alternative that did the job.

Below, you will find a native ARM executable of micro-httpd, a light weight web server that supports CGI.


Use it at your own risk!


It supports .htpasswd files to restrict access to folders - and it comes also with its own utility htpasswd which manipulates the password files.

micro-httpd website:
micro-httpd configuration options:

You can use almost any CGI interpreter you want, minus PHP. The PHP 4 Android (a native implementation of PHP) has only CLI (command line support) and even if you could change the PHP code of the scripts to output the missing headers. BUT! It also outputs debug messages that you cannot control, in the output of the script!

Those messages are are considered errors in HTTP / CGI.
The creators of PHP interpreter say that is only meant for Scripting Languages for Android (SL4A) which works with what they have. You can read more here: This topic also mentions an alternative (CGI this time) from GroomDroid but that is also unstable.

Enter PERL!

I had good success with Perl 4 Android

I can how host a blog on my phone - I've set up a big tutorial on how to configure everything here Running native CGI scripts (perl) with micro-httpd on Android.


Next step would be to try out a file manager and test file upload, then go even deeper to see if I can access various phone details and offer a sort of management interface for them on the web.

Source code

You will find the source code and the license (free) on the tutorial website above.
The Following 3 Users Say Thank You to viulian For This Useful Post: [ View ] Gift viulian Ad-Free
28th August 2011, 05:47 PM |#2  
cdesai's Avatar
Recognized Developer
Thanks Meter: 4,123
Donate to Me
Seems interesting !
Post Reply Subscribe to Thread

Guest Quick Reply (no urls or BBcode)
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes