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
pma_httpd also has some PMA430-specific features,
including the ability to
examine the calendar and to-do list, and play audio files
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.
/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.
/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).
.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.
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.
#!/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
mini_httpd program was very simple, and
pma_httpd is even simpler, to reduce its memory usage to
the absolute minimum.
htpasswd (directory-level security)
functionality at all. I have removed the executable and
all the code in mini_httpd that processes
.htpasswd files. Instead, one
user ID and password applies to the entire server, and these credentials
must be specified on the command line -- no user interface configuration
is possible at present
/media, rather than the
current directory. Under Qtopia, current directory is something of a
meaningless concept.
pma_httpdprogram is closed, any current media playback
will stop, whether playback was launched from this program or otherwise. This is
because the program has no way to tell whether it launched the playback or
something else did. Because playback might be in the background, if this
program did not stop playback on exit, you could be left with content playing
that cannot be stopped.
pma_httpd
is running when the USB cable is connected. This is a peculiarity of
the way that the Qtopia sync mechanism works.
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.