GTK Logo OpenEuphoria Logo server

EuGTK 4.12.0


Euphoria Web Server

version 1.1

This uses a heavily modified httpd.ex (from the Eu demos) to serve up files over the local network.

Apache would work, but who wants to deal with all that arcane stuff?, Besides, I'd still have to write cgi code to display the pages... so why go thru all that just to share some files? This solution is much simpler, and is written in Euphoria, so you can modify it as you wish!

Httpd.ex can work from a command line - just issue %> eui httpd to see the options. When running from the command line, you'll need to enter your server's IP address (use ifconfig to get that), and port, perhaps 8080, and the root (starting directory).

You can run more than one server at a time, just use a different port for each. For example, set the root for port 8081 to your Music/Blues folder, and the root for port 8082 to your Music/Opera folder - that way, listeners won't have to wade thru albums they may be allergic to:)

To make the server easier to use, I've added the EuGTK GUI shown above, which lets you select some options, and then starts the server running in the background when you click the OK button. Once it's running, you just enter the IP address and port in your tablet or phone's browser address bar to connect. e.g: 192.168.1.100:8080


httpd.ex


webserver.ex

Screenshot-18

The appearance of the page is controlled by a file named .httpd.css, if it exists in the currently-browsed folder. This is done so that directory listings from different folders can have their own individual appearances (see screenshot above). If no .httpd.css exists in a given folder, defaults built into httpd.ex will be used.

Screenshot-11

Above, webserver.ex serving a specified file as entered on the address bar, or by clicking on a link in a previous page.

After closing the server, or a crash, it may take several seconds to minutes for your computer to free the port you've used. Trying to run again too soon using the same port will result in an error (-2). I have included a loop which will retry up to 20 times (unless overridden by the -t option), and then abort. If this happens, and you are running from the GUI, you can try hitting the OK button again. It may take several tries, or you may have to shut down the port manually from a terminal.