Version 55 of Tclhttpd Winservice

Updated 2008-11-24 22:32:28 by MHo

From time to time, I'm working on a starpack based on tclhttpd v 3.5.1 which can be run as a Windows Service through the help of Winserv. Additional descriptions are at the bottom and some more probably will be added later.

However, the starpack can be run as a normal program too, not only as a service.

You can download the current version (0.84) here: http://home.arcor.de/hoffenbar/prog/tclhttpd.zip .


http://home.arcor.de/hoffenbar/prog/tclhttpd.jpg


Example cmdline help: (note that it may differ from release to release and from environment to environment as some defaults like paths are constructed dynamically)

 tclhttpd.exe 0.81, based on tclhttpd 3.5.1 and Tcl 8.4.17, modified 27.01.2008 18:45:54, MHo
 usage: tclhttpd.exe {[options]|scriptfile}
  -virtual value       Virtual host config list <>
  -config value               Configuration file <D:/Home/Arbeit1/pgm/tcl/usr/Src/httpd351pack4/tclhttpd.exe/bin/tclhttpd.rc>
  -main value               Per-Thread Tcl script <D:/Home/Arbeit1/pgm/tcl/usr/Src/httpd351pack4/tclhttpd.exe/bin/httpdthread.tcl>
  -docRoot value       Root directory for documents <D:/Home/Arbeit1/pgm/tcl/usr/Src/httpd351pack4/tclhttpd.exe/bin/../htdocs>
  -port value               Port number server is to listen on <8015>
  -host value               Server name, should be fully qualified <matthias>
  -ipaddr value               Interface server should bind to <>
  -https_port value    SSL Port number <8016>
  -https_host value    SSL Server name, should be fully qualified <matthias>
  -https_ipaddr value  Interface SSL server should bind to <>
  -webmaster value     E-mail address for errors <webmaster@matthias>
  -uid value               User Id that server runs under <50>
  -gid value               Group Id for caching templates <50>
  -secs value               Seconds per "minute" for time-based histograms <60>
  -threads value       Number of worker threads (zero for non-threaded) <10>
  -library value       Dir list where custom packages and auto loads are <D:/Home/Arbeit1/pgm/tcl/usr/Src/httpd351pack4/tclhttpd.exe/bin/../custom>
  -debug value               If true, start interactive command loop <0>
  -compat value               Version compatibility to maintain <3.3>
  -gui value               Flag for launching the user interface <1>
  -mail value               Mail Servers for sending email from tclhttpd <>
  -LogFile value       Location and name prefix for logfiles <C:/DOKUME~1/Arbeit1/LOKALE~1/Temp/log>
  -tclcgi value               Runtime to execute tcl-CGIs <C:/programme/Tcl/bin/tclsh.EXE>
  -AuthDefaultFile     value Location for internal authfile <C:/DOKUME~1/Arbeit1/LOKALE~1/Temp/tclhttpd.default>
  -unpacktools               Extract included tools and docs
  -morehelp               Show a few background infos
  -help                       Print this message
  -?                       Print this message

Output of -morehelp

 This Webserver is based on tclhttpd v3.5.1 and tcl. The runtime currently
 is base-tcl-thread-win32-ix86.exe from ActiveTcl tcl 8.4.17.

 This starpack is designed to run as a Windows service through Winserv. It can
 be started interactively, too.

 The VFS-internal htdocs and libs are stripped down somewhat to reduce exe
 size. They are always available unter /adminroot. The CGI demos will not run
 out of the VFS! Code from internal custom dir is loaded first. The 'real'
 custom dir is expected to be outside the VFS, because it's subject to
 changes all the time. Also, it's likely that you will have your own
 tclhttpd.rc-Configuration-file.

 On windows, the auto_path is automatically extended to the lib folder of an
 existing Tcl installation (auto_execok tclsh/../lib). If there is such an
 installation, it also runs Tcl-CGIs. If not, tclkitsh is searched. The last
 fallback is that this program also runs the CGIs.

 An example for installing this starpack as a service:

 winserv install httpd1 -ipcmethod stdio -start demand -description "tclhttpd1"
  -user .\xyz -password abc d:/progs/tclhttpd.exe -config d:/my/httpd.rc
  -library d:/my/custom
 winserv start httpd1

 tclhttpd.exe is under development, so the .exe will change frequently.

 things that could be done or should be noticed:
   - incorporate changes/fixes from later (3.5.2/CVS)-versions
   - replace the cmdline/config-parsing with Spar and readprof (see wiki)
   - adapt new homepage (see http://wiki.tcl.tk/11420 and
      http://www.frbc-va.org/mockup/); a dummy is available at /home2.html
   - create config/tclhttpd.rc equivalents for the newly added cmdline switches
   - add support for more cgi interpreters (php, ...) (no #!-magic on MS Win)
   - reimplement PAUSE and CONTINUE functions in a better way, and implement
      service control e.g. to query several states of the server
   - eventually add separate event logging for Windows eventlog, and/or
     reorganize the whole stdout/stderr/console output stuff
   - (Re-)integration of wikit (whipit), see http://wiki.tcl.tk/11121
   - look further at https:-Support

 ! * use the right account for the service; watch the environment, especially
 !   the PATH-var (additional env-vars could be added through custom code)
 ! * avoid using backslashes in command line arguments; they are not yet
 !   automatically translated

 M.Hoffmann, 2006-2008

(As said, the program will change from time to time and so will this help text.)


To access the build in docs and admin-tools, simply start tclhttpd without any parameters and navigate your browser to localhost:8015. These are always available via url /adminroot even if you have configured your own docRoot (some links may still not work yet).

To implement tclhttpd as a service, you need Winserv, which is available inside tclhttpd.exe an can be extracted via -unpacktools command line switch.


RLH 2006-04-10: Why version 3.4.2 when 3.5.1 is the latest release? MHo I tried 3.5.1 several times and never succeeded in getting it servicing our existing intranet site, driven by 3.4.2/3.4.3 without modifications. It seems to me that there are some changes that are not upward compatible (probably in doc.tcl). I'm working on this. 2006/07/18: v3.5.1 is now the base of my modifications. Remember: Specifying URLs without the .tml-extension only works anymore with documents specifying [Doc_Dynamic]...


History

  • 25.04.2006: Switched to one of the latest dqkit-runtimes (threaded).
  • 12.05.2006: Done auth for /admref (not reflected in -morehelp yet). UserID and password are fixed for now to webadm, /#&goony+
  • 23.05.2006: Switched to tclhttpd v3.5.1; changes not yet reflected here or elsewhere (testing and config in progress). My personal homepage space is exhausted, so I'm currently not able to post any new releases...
  • 18.07.2006: Many many changes to make v3.5.1 work; too many to note them here. Command line changed, help changed accordingly. Basic functionality should be ok now.
  • 28.07.2006: Switched to winserv's -ipcmethod stdio. Several internal changes to work around difficulties with service-mode etc.
  • 25.08.2007: New Version 0.5 with some enhancements (many module and documentation updates and some additions, e.g. tcllib 1.9). Runtime is base-tclsh from Activestate, version 8.4.15. As usual, the changes are not documented in detail here. If interested, post a note here.-
  • 18.10.2007: v0.6 with Tclruntime 8.4.16, some internal docs updated, some unusable code ZIPed, integrated gzip updated, .EXE-size reduced, modules from newest tcllib.
  • 23.10.2007: modified lib/tclhttpd/fallback.tcl to avoid generating double slashes // at the beginning of an URL (see [L1 ])

History for v0.7 and above:

25.10.2007-02.11.2007, v0.7:

  • if no interpreter for CGIs is found, CGIs are interpreted by tclhttpd.exe itself!
  • removed some *Nix-specifica, because this is primilary designed to be a windows program
  • removed Ajuba- and ScripticsLogo*.GIF from htdocs/images (not referenced anywhere)
  • textutil/*.tex replaced by 0 Byte-dummies (not referenced anywhere)
  • htdocs/manual/htdig.html and references removed (very old and for *Nix only)
  • bin/backup_org.zip/util/* (crypt etc.) removed (only *Nix)
  • htdocs/snmp* removed (only makes sense with Scotty and with *Nix, I guess)
  • removed obsolete backup-ZIPs from VFS
  • gzip.exe + docs removed; Logfiles are now ZIPped internally (external gzip.exe only as a fallback) I hope this internal zipping does not the block the whole server for too long periods...
  • Reduced size by ~200k

25.01.2008, v0.8, MHo (sorry: not tested very well yet):

  • bugfix in log.tcl, ZIPped logs where not deleted...
  • runtime now is base-tcl-thread-win32-ix86.exe v8.4.17 from ActiveTcl
  • updated doctools, mime and fileutil and associated manpages
  • removed unneccessary module env from cgi-bin/cgi-bin.zip (*NIX ELF binary makes no sense with Windows) and multiple occurence of some README
  • reduced overall EXE size by approx. 4k

27.01.2008, v0.81, MHo:

  • fixed bug in command line / .rc-file processing (LogFile in .rc has been ignored, internal default always took precedence. Had to specifiy command line switch to overwrite.)

09.07.2008, v0.82, MHo: Time for some changes ;-)

  • Runtime is base-tcl-thread-win32-ix86.exe from ActiveTcl v8.4.19
  • the used parts of textutil updated to v0.71
  • md5crypt updated to v1.10
  • doctools updated to v1.3.2
  • removed unused stuff from zipper/pkgIndex.tcl
  • fixed htdocs/notfound: 'home'-link returns to / instead to non-existing cgi-bin/index
  • fixed bug in newauth (updated to v0.4) and updated documentation for newauth (still "eine Baustelle")

23.09.2008, v0.83, MHo:

  • Runtime base-tcl-thread-win32-ix86.exe 8.4.19.1
  • Refreshes from tcllib 1.10:
  • fileutil
  • md5, md5crypt
  • mime
  • ncgi
  • cmdline
  • base64
  • doctools

20.11.2008, v0.84, MHo:

  • Fixed an awfull bug which prevents from loading if a certain regkey was missing (only present if ActiveTcl installed)...
  • Removed some critcl code from rc4c, md5c, md5cryptc (makes no sense here)
  • Experimental 64bit-Version [L2 ], which probably won't run as a service, because winserv.exe and nologoff.dll are still 32bit. Not tested yet.
  • Experimental Version with Tcl 8.5.5 runtime [L3 ]. Should work but don't... There's a difference I don't understand yet in httpdthread.tcl preventing VFS-internal custom code from loading... (see below)
  • Sometimes pageloads never come to an end, if the server and browser run on the same machine (localhost). Don't remember when this bug was introduced...

I see with 8.5.5:

httpd % glob -dir [file join [info nameofexe] bin .. custom] *

 D:/Home/Arbeit1/pgm/tcl/usr/Src/httpd351pack4/tclhttpd855.exe/bin/../custom/adminroot.tcl D:/Home/Ar
 beit1/pgm/tcl/usr/Src/httpd351pack4/tclhttpd855.exe/bin/../custom/extend_auto_path.tcl D:/Home/Arbei
 t1/pgm/tcl/usr/Src/httpd351pack4/tclhttpd855.exe/bin/../custom/faq.tcl D:/Home/Arbeit1/pgm/tcl/usr/S
 rc/httpd351pack4/tclhttpd855.exe/bin/../custom/hello.tcl D:/Home/Arbeit1/pgm/tcl/usr/Src/httpd351pac
 k4/tclhttpd855.exe/bin/../custom/htmlutils.tcl D:/Home/Arbeit1/pgm/tcl/usr/Src/httpd351pack4/tclhttp
 d855.exe/bin/../custom/mypage.tcl D:/Home/Arbeit1/pgm/tcl/usr/Src/httpd351pack4/tclhttpd855.exe/bin/
 ../custom/newauth.dat D:/Home/Arbeit1/pgm/tcl/usr/Src/httpd351pack4/tclhttpd855.exe/bin/../custom/ne
 wauth.tcl D:/Home/Arbeit1/pgm/tcl/usr/Src/httpd351pack4/tclhttpd855.exe/bin/../custom/zzzdodirs.tcl
 httpd % glob -dir [file join [info nameofexe] bin .. custom] *.tcl
 D:/Home/Arbeit1/pgm/tcl/usr/Src/httpd351pack4/tclhttpd855.exe/bin/../custom/adminroot.tcl D:/Home/Ar
 beit1/pgm/tcl/usr/Src/httpd351pack4/tclhttpd855.exe/bin/../custom/extend_auto_path.tcl D:/Home/Arbei
 t1/pgm/tcl/usr/Src/httpd351pack4/tclhttpd855.exe/bin/../custom/faq.tcl D:/Home/Arbeit1/pgm/tcl/usr/S
 rc/httpd351pack4/tclhttpd855.exe/bin/../custom/hello.tcl D:/Home/Arbeit1/pgm/tcl/usr/Src/httpd351pac
 k4/tclhttpd855.exe/bin/../custom/htmlutils.tcl D:/Home/Arbeit1/pgm/tcl/usr/Src/httpd351pack4/tclhttp
 d855.exe/bin/../custom/mypage.tcl D:/Home/Arbeit1/pgm/tcl/usr/Src/httpd351pack4/tclhttpd855.exe/bin/
 ../custom/newauth.tcl D:/Home/Arbeit1/pgm/tcl/usr/Src/httpd351pack4/tclhttpd855.exe/bin/../custom/zz
 zdodirs.tcl

httpd % glob [file join [info nameofexe] bin .. custom *.tcl]

 no files matched glob pattern "D:/Home/Arbeit1/pgm/tcl/usr/Src/httpd351pack4/tclhttpd855.exe/bin/../
 custom/*.tcl"
 httpd %

Could it be, at least inside a starpack, that the behaviour of glob changed from 8.4 to 8.5???