1
2
3package require XOTcl; namespace import -force xotcl::*
4
5# DEMO OF USE OF ACTIWEB AND SSL
6# 03/09/01 klaus.kolowratnik@wu-wien.ac.at
7# version 0.806 
8
9# USAGE:
10#
11# For secure http connections under Tcl or XOTcl we need the tls-package.
12# The following code was tested with tls-version 1.4 successfully.
13# Download the tls1.4-package from the TLS-Homepage
14# (http://sourceforge.net/projects/tls/) and install the
15# tarball (tls1.4.1-linux-x86.tar.gz) in your local filesystem.
16# You have to append the path of the tls-package to the 
17# Tcl-variable "auto_path" as seen in the example below
18#
19# 	lappend auto_path $homeDir/tls1.4 $homeDir/projects/actiweb
20#
21# Don't forget to add the tls-package to your "pkgIndex.tlc"-file!
22#
23#	package ifneeded tls 1.4 "[list load [file join $dir libtls1.4.so] ] ; \
24#		[list source [file join $dir tls.tcl]]"
25#
26# For secure http connections ("http://...") we need at least the Actiweb/XOTcl-
27# package "secureHtmlPlace":
28#
29#	package require xotcl::actiweb::secureHtmlPlace
30#	package require xotcl::actiweb::webDocument
31#
32# We have to register the private server-keyfile and the certifcates
33# of the local server and the certification authority.
34# If you want to create own self-signed certificates, you can use the
35# "SimpleCA"-Certification Authority (http://users.skynet.be/ballet/joris/SimpleCA).
36#
37# 	This example uses the following certificates and key-files:
38#
39# 	server.key	private key of the local server which is run by this program
40# 	server.pem	certificate of the local server which is run by this program
41#			in PEM-format
42# 	cacert.pem	certificate of the certification authority
43#
44#
45#	SecureHtmlPlace ::receiver -port 8443 -keyfile server.key \
46#			-certfile server.pem -cafile cacert.pem 
47#
48# With this changes a https-server with XOTcl can be run.
49#
50# 2003/11/19 Klaus.Kolowratnik@wu-wien.ac.at
51
52set homeDir ~h9252717; 	# home-directory of Klaus
53lappend auto_path $homeDir/packages
54
55package require xotcl::actiweb::htmlPlace
56package require xotcl::actiweb::secureHtmlPlace
57package require xotcl::actiweb::webDocument
58
59#HtmlPlace ::receiver -port 8445 
60SecureHtmlPlace ::receiver -port 8445 -keyfile server.key -certfile server.pem -cafile cacert.pem 
61
62HtmlDocument test-1.txt -content "************ TEST-1 *************"
63::receiver exportObjs test-1.txt
64test-1.txt exportProcs content
65#test-1.txt attachFile ~/public_html/index.html
66
67HtmlDocument test-2.txt -content "************ TEST-2 *************"
68::receiver exportObjs test-2.txt
69test-2.txt exportProcs content
70
71set readme "This Web-Server uses XOTcl (www.xotcl.org) and Actiweb"
72HtmlDocument readme.txt -content $readme
73::receiver exportObjs readme.txt
74readme.txt exportProcs content
75
76FileObjectifier do
77do objectifyTree ::receiver ~/public_html
78
79#GraphicDirectoryObjectifier gdo
80#gdo objectifyTree ::receiver ~www/bilder/Einweihung/disk1/
81
82::receiver startEventLoop 
83