![]() |
![]() |
|
The Apache/TCL integration project brings together the full power of the TCL programming language and the Apache HTTP server.
With mod_tcl it is possible to write Apache modules entirely in TCL. In addition, the persistent interpreter embedded in the server avoids the overhead of starting an external interpreter and the penalty of TCL start-up time.
Table of Contents:Download of source is available through anonymous cvs at apache.org. .tar.gz snapshot packages will posted at regular intervals until development as completed at which time release packages will be posted. fractal.net runs the latest development of mod_tcl, you may want to check there for what the latest development version is.
cvs -d:pserver:anoncvs@www.apache.org:/home/cvspublic checkout tcl-modtclFirst you will need to download a copy of mod_tcl. Depending on where your distribution came from (cvs, .tgz, etc.) your directory will be named different. I will assume that the directory is named mod_tcl for the purpose of this installation procedure. You will also need a copy of autoconf which is available from any GNU distribution.
Next, place the mod_tcl directory into Apache's modules directory. For example if using Apache 2.0.14 this would be placed in httpd-2_0_14/modules/mod_tcl. Change directory to httpd-2_0_14 and run the command autoconf and then autoheader. You may now procedure with a make.
It is possible to compile mod_tcl as a shared object by passing arguments to the configuration script of Apache. Use the switch --enable-mods-shared=tcl to enable mod_tcl to be built as a shared object.
In summary the follow procedure was described above.
% tar -zxf mod_tcl.tar.gz % mv mod_tcl httpd-2_0_16/modules/. % cd httpd-2_0_16 % autoconf % autoheader % ./configure % make
The configuration directives for mod_tcl should be configured inside of a <Directory> or <Location>. The <Tcl> fields should be declared outside of a <Directory> or <Location> because the <Tcl> directives add logic to the global namespace.
Determine if the module should be active @param 1 On or Off Tcl Set an array variable or a scalar variable @param 1 Array variable if param 3 is non-null, otherwise a scalar variable @param 2 Name of an array element if param 3 is non-null, otherwise value to set scalar @param 3 Value to set array element to Tcl_Var Append to a list @param 1 List variable to append to @param 2 Value to append Tcl_ListVar Add a content handler to be executed @param 1 The name of a procedure that is to be called when a content handler is called Tcl_ContentHandler Add a post read request hook @param 1 The name of a procedure that is to be called when a read request hook is called Tcl_Hook_Post_Read_Request Add a translate name hook @param 1 The name of a procedure that is to be called when a translate name hook is called Tcl_Hook_Translate_Name Add a header parser hook @param 1 The name of a procedure that is to be called when a header parser hook is called Tcl_Hook_Header_Parser Add an access checker hook @param 1 The name of a procedure that is to be called when an access checker hook is called Tcl_Hook_Access_Checker Add a check user id hook @param 1 The name of a procedure that is to be called when a check user id hook is called Tcl_Hook_Check_User_ID Add an auth checker hook @param 1 The name of a procedure that is to be called when an auth checker hook is called Tcl_Hook_Auth_Checker Add a type checker hook @param 1 The name of a procedure that is to be called when a type checker hook is called Tcl_Hook_Type_Checker Add a fixups hook @param 1 The name of a procedure that is to be called when a fixups hook is called Tcl_Hook_Fixups Add a log transaction hook @param 1 The name of a procedure that is to be called when a log transaction hook is called Tcl_Hook_Log_Transaction Add raw TCL to the interpeter @param 1 A TCL script that will be executed in the interpreter <Tcl> End adding raw TCL to the interpreter </Tcl>
Here is some preliminary documentation which really could be made prettier. Important things to note are, all the constants and commands are made available in the ::apache namespace. Therefore you must either import this namespace or use namespace scope operators to use the constants and commands.
Constants Provided
------------------
DECLINED
DONE
OK
M_POST
M_GET
M_PUT
M_DELETE
M_CONNECT
M_OPTIONS
M_TRACE
M_PATCH
M_PROPFIND
M_PROPPATCH
M_MKCOL
M_COPY
M_MOVE
M_LOCK
M_UNLOCK
M_INVALID
HTTP_CONTINUE
HTTP_SWITCHING_PROTOCOLS
HTTP_PROCESSING
HTTP_OK
HTTP_CREATED
HTTP_ACCEPTED
HTTP_NON_AUTHORITATIVE
HTTP_NO_CONTENT
HTTP_RESET_CONTENT
HTTP_PARTIAL_CONTENT
HTTP_MULTI_STATUS
HTTP_MULTIPLE_CHOICES
HTTP_MOVED_PERMANENTLY
HTTP_MOVED_TEMPORARILY
HTTP_SEE_OTHER
HTTP_NOT_MODIFIED
HTTP_USE_PROXY
HTTP_TEMPORARY_REDIRECT
HTTP_BAD_REQUEST
HTTP_UNAUTHORIZED
HTTP_PAYMENT_REQUIRED
HTTP_FORBIDDEN
HTTP_NOT_FOUND
HTTP_METHOD_NOT_ALLOWED
HTTP_NOT_ACCEPTABLE
HTTP_PROXY_AUTHENTICATION_REQUIRED
HTTP_REQUEST_TIME_OUT
HTTP_CONFLICT
HTTP_GONE
HTTP_LENGTH_REQUIRED
HTTP_PRECONDITION_FAILED
HTTP_REQUEST_ENTITY_TOO_LARGE
HTTP_REQUEST_URI_TOO_LARGE
HTTP_UNSUPPORTED_MEDIA_TYPE
HTTP_RANGE_NOT_SATISFIABLE
HTTP_EXPECTATION_FAILED
HTTP_UNPROCESSABLE_ENTITY
HTTP_LOCKED
HTTP_FAILED_DEPENDENCY
HTTP_INTERNAL_SERVER_ERROR
HTTP_NOT_IMPLEMENTED
HTTP_BAD_GATEWAY
HTTP_SERVICE_UNAVAILABLE
HTTP_GATEWAY_TIME_OUT
HTTP_VERSION_NOT_SUPPORTED
HTTP_VARIANT_ALSO_VARIES
HTTP_INSUFFICIENT_STORAGE
HTTP_NOT_EXTENDED
REMOTE_HOST
REMOTE_NAME
REMOTE_NOLOOKUP
REMOTE_DOUBLE_REV
APLOG_EMERG
APLOG_ALERT
APLOG_CRIT
APLOG_ERR
APLOG_WARNING
APLOG_NOTICE
APLOG_INFO
APLOG_DEBUG
APLOG_NOERRNO
REQUEST_NO_BODY
REQUEST_CHUNKED_ERROR
REQUEST_CHUNKED_DECHUNK
Commands
--------
Abort request
@param 1 A string with the reason of abortion
@deffunc abort 1
abort
Read posted data and set the array pram
@deffunc read_post
read_post
Generate a random integer
@return An integer
@deffunc random
random
Seed random number generation
@param 1 An integer to seed random number generation
@deffunc srandom 1
srandom
Encode data to base64
@param 1 Data to be encoded
@return Base64 string of converted data
@deffunc base64_encode 1
base64_encode
Decode data from base64
@param 1 Base64 string to be converted to data
@return Data that was converted from base64
@deffunc base64_decode
base64_decode
Call ap_allow_options
@return An integer with the mask of options
@deffunc ap_allow_options
ap_allow_options
Call ap_allow_overrides
@return An integer
@deffunc ap_allow_overrides
ap_allow_overrides
Call ap_default_type
@return A string
@deffunc ap_default_type
ap_default_type
Call ap_document_root
@return A string
@deffunc ap_document_root
ap_document_root
Call ap_get_remote_host
@param 1 An integer specifying the type of lookup
@return A string
@deffunc ap_get_remote_host 1
ap_get_remote_host
Call ap_get_remote_logname
@return A string
@deffunc ap_get_remote_logname
ap_get_remote_logname
Call ap_construct_url
@param 1 A uri
@return A string
@deffunc ap_construct_url 1
ap_construct_url
Call ap_get_server_name
@return A string
@deffunc ap_get_server_name
ap_get_server_name
Call ap_get_limit_req_body
@return An integer
@deffunc ap_get_limit_req_body
ap_get_limit_req_body
Call ap_get_limit_xml_body
@return An integer
@deffunc ap_get_limit_xml_body
ap_get_limit_xml_body
Call ap_custom_response
@param 1 An integer
@param 2 A string
@deffunc ap_custom_response 1 2
ap_custom_response
Call ap_exists_config_define
@param 1 A string
@return An integer
@deffunc ap_exists_config_define 1
ap_exists_config_define
Call ap_auth_type
@return A string
@deffunc ap_auth_type
ap_auth_type
Call ap_auth_name
@return A string
@deffunc ap_auth_name
ap_auth_name
Call ap_satisfies
@return An integer
@deffunc ap_satisfies
ap_satisfies
Call ap_requires
@return A list { {integer, string} ... }
@deffunc ap_requires
ap_requires
Call ap_log_error
@param 1 An integer specifying log level
@param 2 An integer specifying the status
@param 3 A string specifying the error
@deffunc ap_log_error 1 2 3
ap_log_error
Call ap_send_http_header
@deffunc ap_send_http_header
ap_send_http_header
Call ap_send_http_trace
@return An integer
@deffunc ap_send_http_trace
ap_send_http_trace
Call ap_send_http_options
@return An integer
@deffunc ap_send_http_options
ap_send_http_options
Call ap_finalize_request_protocol
@deffunc ap_finalize_request_protocol
ap_finalize_request_protocol
Call ap_send_error_response
@param 1 An integer with recursion level
@deffunc ap_send_error_response
ap_send_error_response
Call ap_set_content_length
@param 1 An integer specifying length
@deffunc ap_set_content_length 1
ap_set_content_length
Call ap_set_keepalive
@return An integer
@deffunc ap_set_keepalive
ap_set_keepalive
Call ap_rationalize_mtime
@param 1 An integer specifying mtime
@return An integer
@deffunc ap_rationalize_mtime 1
ap_rationalize_mtime
Call ap_make_etag
@param 1 An integer specifying force_weak
@return A string
@deffunc ap_make_etag 1
ap_make_etag
Call ap_set_etag
@deffunc ap_set_etag
ap_set_etag
Call ap_set_last_modified
@deffunc ap_set_last_modified
ap_set_last_modified
Call ap_meets_conditions
@return An integer
@deffunc ap_meets_conditions
ap_meets_conditions
Call ap_rputs
@param 1 Either -nonewline or a string to write
@param 2 if param 1 is -nonewline then a string to write
@deffunc ap_rputs 1 2
ap_rputs
Call ap_rwrite
@param 1 Data to write
@deffunc ap_rwrite 1
ap_rwrite
Call ap_rflush
@deffunc ap_rflush
ap_rflush
Call ap_get_status_line
@param 1 An integer specifying status
@return A string
@deffunc ap_get_status_line 1
ap_get_status_line
Call ap_setup_client_block
@param 1 An integer specifying read policy
@return An integer
@deffunc ap_setup_client_block 1
ap_setup_client_block
Call ap_get_client_block, sets variable R with data
@param 1 An integer specifying the number of bytes to read
@return An integer specifying the actual number of bytes read
@deffunc ap_get_client_block 1
ap_get_client_block
Call ap_discard_request_body
@return An integer
@deffunc ap_discard_request_body
ap_discard_request_body
Call ap_note_auth_failure
@deffunc ap_note_auth_failure
ap_note_auth_failure
Call ap_note_basic_auth_failure
@deffunc ap_note_basic_auth_failure
ap_note_basic_auth_failure
Call ap_note_digest_auth_failure
@deffunc ap_note_digest_auth_failure
ap_note_digest_auth_failure
Call ap_get_basic_auth_pw, sets R with password
@return An integer
@deffunc ap_get_basic_auth_pw
ap_get_basic_auth_pw
Call ap_parse_uri
@param 1 A string specifying a uri
@deffunc ap_parse_uri 1
ap_parse_uri
Call ap_method_number_of
@param 1 A string with a method name
@return An integer specifying the method number
@deffunc ap_method_number_of 1
ap_method_number_of
Call ap_method_name_of
@param 1 An integer specifying a method number
@return A string specifying a method name
@deffunc ap_method_name_of 1
ap_method_name_of
Call ap_internal_redirect
@param 1 A string specifying a uri to redirect to
@deffunc ap_internal_redirect 1
ap_internal_redirect
Call ap_internal_redirect_handler
@param 1 A string specifying a uri to redirect to
@deffunc ap_internal_redirect_handler 1
ap_internal_redirect_handler
Call ap_some_auth_required
@return An integer
@deffunc ap_some_auth_required
ap_some_auth_required
Call ap_update_mtime
@param 1 An integer specifying a dependancy
@deffunc ap_update_mtime 1
ap_update_mtime
Call ap_allow_methods
@param 1 An integer specifying a reset
@param 2 A string specifying methods
@deffunc ap_allow_methods 1 2
ap_allow_methods
Call ap_get_server_version
@return A string
@deffunc ap_get_server_version
ap_get_server_version
Call ap_add_version_component
@param 1 A string specifying a version component to add
@deffunc ap_add_version_component 1
ap_add_version_component
Call ap_get_server_built
@return A string
@deffunc ap_get_server_built
ap_get_server_built
Call ap_create_environment, sets array env
@deffunc ap_create_environment
ap_create_environment
Reads variables from request_rec structure
@param 1 variable or "connection" or "server"
@param 2 if param 1 "connection" or "server" then a variable to read
@return The variable read, could be an integer, string, or list
@deffunc r 1 2
r
Sets variables in request_rec structure
@param 1 variable or "connection" or "server"
@param 2 if param 1 "connection" or "server" then variable
@param x variable list of data to be written
@deffunc r_set 1 2 ...
r_set
Ouput text/html
@param 1 A script of text to output
@deffunc output 1
output
- 1.0d0 -| Inital port from mod_tcl* 0.26, single file split into 4
| (Apache 2.0a9)
|
- 1.0d1 -| removal of nasties, update of configuration
|
- 1.0d2 -| addition of some API commands
|
- 1.0d3 -| more of API exposed, new config option, inital checkin to CVS
|
- 1.0d4 -| Documentation, 90% of API exposed
|
- 1.0d5 -| constants commands in ::apache namespace, mmap checking, test
| script
|
- 1.0d6 -| ap_send_http_header deprecated, updated to be peachy with
| Apache 2.0.14
|
% 1.0d7 %| alive and well
|
- 1.0d8 -|
|
- 1.0d9 -|
|
- 1.0.0 -|
Currently bug reports can be mailed to mod_tcl-dev@tcl.apache.org.
| Updated: Michael Link, 20010430 |