httcld is a very small HTTP server with an embedded TCL (http://www.tcl.tk/) interpreter. In addition to static .html files, it serves .htcl files, which are HTML with embedded tcl code. The tcl is executed on the server, and the resulting output is embedded in the stream sent back to the client. In addition, variables in the tcl namespace may be set and retrieved directly, say by an AJAX script.
The idea for this server came out of a need to have a flexible, fast, but very lightweight backend to support a GUI on an embedded platform. I also wanted efficient support for a more dynamic AJAX-like interface, but the existing backends were much too big for the box. Apache and it's modules took too much memory and storage space, Ruby and Rails likewise. Java was right out.
Thus was born the idea of a specialized HTTP server that could update a very dynamic UI without any more CPU overhead than necessary. Along the way, I decided that it would be nice if I could make the web pages in the UI smarter. This led to the embedded .htcl format.
www.gnu.org/software/libmicrohttpd Version 0.4.0pre1and
www.tcl.tk Version 8.5
The server also directly contains hash table code from David Crawshaw http://www.zentus.com/c/hash.html
The README file in the source distribution has complete information on building, configuring, and operating the server.
Here's an example .htcl file, illustrating embedded tcl and AJAX support (this is protoclock3.htcl in the examples/ directory):
This page, once loaded and started, looks like this in the browser:
Everything within the <tcl> </tcl> tags is executed on the server, the rest is passed unchanged to the browser.
I used Prototype in the examples created so far. There's no reason that it wouldn't work just as well with Dojo, script.aculo.us, OAT, qooxdoo, or any other AJAX framework. Or, you don't even need a browser at all. Say you wanted a console TUI (thxt-based UI). You could write a shell script using curl to query server values using the /tcl/ URL handler, and dialog to present them to the user. Simple.
There are the usual forums at Sourceforge - feel free to post questions or suggestions. Or drop me an email if you have any comments. I intend to improve the server and add features as I need them, but suggestions are always welcome.
Copyright (C) 2008 Mark Anacker
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|Last updated: 12/25/2008||Project Web Hosted by|