| [ Team LiB ] |
|
Chapter 18. TclHttpd Web ServerThis chapter describes TclHttpd, a Web server built entirely in Tcl. The Web server can be used as a standalone server, or it can be embedded into applications to Web-enable them. TclHttpd provides a Tcl+HTML template facility that is useful for maintaining site-wide look and feel, and an Application Direct URL that invokes a Tcl procedure in an application. TclHttpd started out as about 175 lines of Tcl that could serve up HTML pages and images. The Tcl socket and I/O commands make this easy, and the C language implementation of the Tcl runtime library makes the server surprisingly fast. Of course, there are lots of features in Web servers like Apache or Netscape that were not present in the first prototype. Steve Uhler took my prototype, refined the HTTP handling, and aimed to keep the basic server under 250 lines. I went the other direction, setting up a modular architecture, adding in features found in other Web servers, and adding some interesting ways to connect TclHttpd to Tcl applications. Today TclHttpd is used both as a general-purpose Web server, and as a framework for building server applications. It implements www.tcl.tk and a number of other general purpose Web sites. It is also built into several commercial applications such as license servers and mail spam filters. The server is freely available, just like Tcl itself, and you can use it in any application without restriction or license fees. Instructions for setting up the TclHttpd on your platform are given toward the end of the chapter, on page 284. It works on Unix, Windows, and Macintosh. Using TclHttpd, you can have your own Web server up and running quickly. This chapter provides an overview of the server and several examples of how you can use it. The chapter is not an exhaustive reference to every feature. Instead, it concentrates on a very useful subset of server features that I use the most. |
| [ Team LiB ] |
|