The K-Zone: pma_httpd -- a web server for the Archos PMA430

Now with Qtopia installer!

Version 0.01, (c)2004-2005 Kevin Boone, Based in part on mini_httpd v1.96, (c)1995-2003 Jef Poskanzer

What is this?

This is a small, highly simplified HTTP (Web) server for the Archos PMA430. It allows the PMA's contents to be examined and downloaded by a Web browser. pma_httpd also has some PMA430-specific features, including the ability to examine the calendar and to-do list, and play audio files

Installation and startup

Download the installer from here. Copy the installer pma_httpd_0.01_pma430.ipk to the PMA430's Documents directory. Install from the Qtopia application manager in the usual way. You should get an icon labelled pma_httpd in the Applications tab of the launcher.

Ensure that the network link (wireless or wired) is started before trying to talk to the server from a browser.

pma_httpd creates a main window, but the main window doesn't do anything. No user interaction is required, or useful, once the program is running. The main window is only presented at all so you can close the server when you've finished with it (by clicking the `close' icon in the corner of the window).

When executed from the launcher, the server listens on port 80. There is no way to change this at present. If you prefer, you can run the server from the command line, like this:

# /opt/Qtopia/bin/pma_httpd &
A number of command-line switches are available, including settings for security, port number, document root, etc. I will consider adding the ability to configure these things to the Qtopia user interface if there is demand.

Document root and index handling

The document root defaults to /media. If you put an index.html file in this directory (over the USB connection, for example), then that file will be delivered when the browser makes a request for the root document. If there is no index.html, either in the document root or any other reachable directory, the browser will get a listing of directory contents instead.

PMA430-specific features

If your browser issues a request for the URLs /today, /week, /month, or /year, the server will return a list of calendar events that fall within the specified time period. It will also return all the active to-do list entries (regardless of time).
      There is also rudimentary audio support. If you list a directory containing .mp3 or .wma files, these files will have a `play' link appended. If you click this link, the file will be played through the PMA's built-in media player. If the media player user interface is displayed before launching an audio file this way, then the user interface will show the playback progress. If the play mode of the built-in audio player is `folder' or `playlist', and playback is already in progress when you launch an audio file from the web browers, then when the selected file has been played, the media player will move on to the the next file in its own playlist. If the user interface is not displayed, playback will be entirely in the background.

CGI support

pma_httpd has rudimentary CGI support. Any file that contains the string `.cgi' in its name will be executed as a CGI script when requested by the brower, and the output of the script routed back to the browser. This can be quite a handy way of running scripts on the PMA430, as its built-in file browser has no mechanism for doing so (as far as I know). The usual rules apply: the script must output the string content-type:text/plain (or whatever the content type is) as its first line, followed by a blank line. Please bear in mind that the script gets only a minimal environment, so don't assume that variables like PATH or QTDIR are set to anything.
      Here is an example of a script which enables an external USB mouse. If you put this script somewhere on the PMA's media area, and navigate to it using a browser, you can click it to enable the mouse.
#!/bin/sh
echo content-type:text/plain
echo
                                                                                
export LD_LIBRARY_PATH=/opt/Qtopia/lib
export QTDIR=/opt/Qtopia
/opt/Qtopia/bin/qcop 'QPE/System' 'setMouseProto(QString)' 'IntelliMouse:/dev/inecho Mouse switched on

Differences from the original mini_httpd

The original mini_httpd program was very simple, and pma_httpd is even simpler, to reduce its memory usage to the absolute minimum.

Bugs and limitations

Here are the most obvious ones.

Legal stuff

pma_httpd is distributed according to the GNU Public Licence. In short, you may do whatever you wish with this code, provided that the original authors continue to be acknowledged, and the original source code is made available.
©1994-2006 Kevin Boone, all rights reserved