

package require XOTcl 1; namespace import -force xotcl::*

# DEMO OF USE OF ACTIWEB AND SSL
# 03/09/01 klaus.kolowratnik@wu-wien.ac.at
# version 0.806 

# USAGE:
#
# For secure http connections under Tcl or XOTcl we need the tls-package.
# The following code was tested with tls-version 1.4 successfully.
# Download the tls1.4-package from the TLS-Homepage
# (http://sourceforge.net/projects/tls/) and install the
# tarball (tls1.4.1-linux-x86.tar.gz) in your local filesystem.
# You have to append the path of the tls-package to the 
# Tcl-variable "auto_path" as seen in the example below
#
# 	lappend auto_path $homeDir/tls1.4 $homeDir/projects/actiweb
#
# Don't forget to add the tls-package to your "pkgIndex.tlc"-file!
#
#	package ifneeded tls 1.4 "[list load [file join $dir libtls1.4.so] ] ; \
#		[list source [file join $dir tls.tcl]]"
#
# For secure http connections ("http://...") we need at least the Actiweb/XOTcl-
# package "secureHtmlPlace":
#
#	package require xotcl::actiweb::secureHtmlPlace
#	package require xotcl::actiweb::webDocument
#
# We have to register the private server-keyfile and the certifcates
# of the local server and the certification authority.
# If you want to create own self-signed certificates, you can use the
# "SimpleCA"-Certification Authority (http://users.skynet.be/ballet/joris/SimpleCA).
#
# 	This example uses the following certificates and key-files:
#
# 	server.key	private key of the local server which is run by this program
# 	server.pem	certificate of the local server which is run by this program
#			in PEM-format
# 	cacert.pem	certificate of the certification authority
#
#
#	SecureHtmlPlace ::receiver -port 8443 -keyfile server.key \
#			-certfile server.pem -cafile cacert.pem 
#
# With this changes a https-server with XOTcl can be run.
#
# 2003/11/19 Klaus.Kolowratnik@wu-wien.ac.at

set homeDir ~h9252717; 	# home-directory of Klaus
lappend auto_path $homeDir/packages

package require xotcl::actiweb::htmlPlace
package require xotcl::actiweb::secureHtmlPlace
package require xotcl::actiweb::webDocument

#HtmlPlace ::receiver -port 8445 
SecureHtmlPlace ::receiver -port 8445 -keyfile server.key -certfile server.pem -cafile cacert.pem 

HtmlDocument test-1.txt -content "************ TEST-1 *************"
::receiver exportObjs test-1.txt
test-1.txt exportProcs content
#test-1.txt attachFile ~/public_html/index.html

HtmlDocument test-2.txt -content "************ TEST-2 *************"
::receiver exportObjs test-2.txt
test-2.txt exportProcs content

set readme "This Web-Server uses XOTcl (www.xotcl.org) and Actiweb"
HtmlDocument readme.txt -content $readme
::receiver exportObjs readme.txt
readme.txt exportProcs content

FileObjectifier do
do objectifyTree ::receiver ~/public_html

#GraphicDirectoryObjectifier gdo
#gdo objectifyTree ::receiver ~www/bilder/Einweihung/disk1/

::receiver startEventLoop 
