==================== ZWS (ZSH Web Server) ==================== :Author: Adam Chodorowski :Homepage: http://www.chodorowski.com/software/zws/ ZWS is a simple web server written in ZSH. It implements HTTP/0.9 and a small subset of HTTP 1.0 but works well with most clients anyway. It can optionally generate directory listings (which also provide an integrated search functionality). Legal ===== This program is copyright © 2004-2006, Adam Chodorowski. All rights reserved. It is distributed under the terms of version 2 of the GNU General Public License. Please see the file ``License/GNU-GPL-2`` for the complete license text or read it online at http://www.gnu.org/licenses/gpl.html. The included icons come from the Tango Desktop Project and are copyrighted by various authors. They are distributed under the terms of version 2.5 (or later) of the Creative Commons Attribution Share-Alike License. Please see the file ``Licenses/CC-BySA-2.5`` for the complete license text or read it online at http://creativecommons.org/licenses/by-sa/2.5/. Features ======== + Requires only a recent version of ZSH and some common UNIX commands. + Supports HTTP/0.9 and a small subset of HTTP/1.0 and HTTP/1.1: - Sends ``Date``, ``Last-Modified`` and ``Content-Length`` header fields. - Supports resumed transfers, albeit with poor performance (sends ``Accept-Ranges`` and ``Content-Range`` fields, reads and parses the ``Range`` field). - Replaces printable characters escaped with %XX in URLs. + Does a simple check to dissallow reading files from outside the web root. + Optionally generates directory listings (with integreated search). Requirements ============ + ZSH 4.2.0 or later + The UNIX commands tr, dd, cut, sed, grep, file, basename and dirname. Options ======= ``-d`` Enable debug mode. Various debug messages will be written to the log file, and the server will also invoke itself as an external command for each incoming connection. This is slower but useful when developing since the server doesn't have to be restarted to test changes. ``-i`` Enable automatic directory listing (with integrated search). Listings for directories without an index file (ie. ``index.html`` will automatically be generated. WARNING: This also enables the search feature, which might potentially be a security risk (the search terms are passed verbatim to the globbing functionality of ZSH). ``-l PATH`` [default: ZWS.log] Specify the path to the log file (not used unless ``-d`` is also used). ``-p PORT`` [default: 4280] Specify the port to listen on for incoming connections. ``-r DIRECTORY`` [default: WWW] Specify the web root directory. Files will be served from this and all subdirectories. Known Issues ============ + Incomplete (un)escaping of characters: - Character escapes in URIs with uppercase hexadecimal digits aren't handled. - Query parameters aren't unescaped properly. - Only a handful och characters are escaped in directory listings. + Resumed transfers are extremely slow. Changes ======= 1.1 (2006-03-08) ---------------- Incompatabilities: + The option to specify the path to the log file has been changed from ``-d`` to ``-l`` (``-d`` now enables debug mode). Additions: + Wrote documentation. + Implemented optional generation of directory listings. Features icons, friendly path navigation and recursive searching from the current directory. + Added the ``-d`` option to enable debug mode. Apart from writing debug messages to the log file specified with ``-l``, this also makes the server invoke itself as an external command for each connection to facilitate easier testing while developing. Exterminations: + When decoding the requested path only the first occurance of a particular character escape was replaced. For example, "a%20b%20c" would be decoded to "a b%20c" instead of correctly to "a b c". + Error pages weren't sent because of a typo in the path name (the directory with the error pages is named "Errors", but the code thought it was named "errors"). + The mime type wasn't detected correctly for MPEG files because 'file' prints garbage. Atleast version 4.13 on Gentoo is affected. This is worked around by hardcoding the mime type of files named *.mpeg to video/mpeg. + The emulation mode and required options weren't set at the beginning of the script, which could lead to incorrect behaviour for people with strange (ie., different than mine) configurations. 1.0 (2004-05-29) ---------------- Initial public release.