Symbols

#, magnus.conf comments 74
&, form data encoding 33
+, enCoded spaces 32
=
encoding for ISINDEX queries 42
form data encoding 33

A

abbrev, value of sizefmt attribute 51
ABORTED constant 181
access
authorization 39
logging 238
accessing environment variables 35
activating CGI file types 48
AddLog directive
describedAddlog
step 71
obj.conf 237
Administration password 243
admpw file 243
AIX, compiling for 101
API
servers use of 18
API function 96
API functions
cif_find 103
condvar_init 104
condvar_notify 104
condvar_terminate 105
condvar_wait 105
crit_enter 106
crit_exit 106
crit_init 106
crit_terminate 107
daemon_atrestart 107
filebuf_buf2sd 108
filebuf_close 108
filebuf_getc 109
filebuf_open 109
filebuf_open_nostat 110
FREE 110
func_exec 111
func_find 111
log_error 112
magnus_atrestart 113
MALLOC 113
net_ip2host 114
net_read 115
net_socket 115
net_write 116
netbuf_buf2sd 116
netbuf_close 117
netbuf_getc 117
netbuf_grab 117
netbuf_open 118
param_create 118
param_free 119
pblock_copy 119
pblock_create 120
pblock_dup 120
pblock_find 121
pblock_findval 121
pblock_free 122
pblock_nninsert 122
pblock_nvinsert 123
pblock_pb2env 124
pblock_pblock2str 124
pblock_pinsert 125
pblock_remove 125
pblock_str2pblock 126
PERM_FREE 126
PERM_MALLOC 127
PERM_STRDUP 127
protocol_dump822 128
protocol_set_finfo 128
protocol_start_response 129
protocol_status 130
protocol_uri2url 131
REALLOC 132
request_create 133
request_free 133
request_header 133
request_stat_path 134
request_translate_uri 135
sem_grab 135
sem_init 136
sem_release 136
sem_terminate 137
sem_tgrab 137
session_create 137
session_free 138
session_maxdns 138
shexp_casecmp 139
shexp_cmp 139
shexp_match 141
shexp_valid 141
shmem_alloc 142
shmem_free 142
STRDUP 143
system_errmsg 143
system_fclose 144
system_flock 144
system_fopenRO 145
system_fopenRW 145
system_fopenWA 146
system_fread 146
system_fwrite 147
system_fwrite_atomic 147
system_gmtime 148
system_localtime 148
system_ulock 149
system_unix2local 149
systhread_current 150
systhread_getdata 150
systhread_newkey 151
systhread_setdata 151
systhread_sleep 152
systhread_start 152
systhread_terminate 152
systhread_timerset 153
uti_uri_escape 163
util_can_exec 153
util_chdir2path 154
util_env_create 154
util_env_find 155
util_env_free 155
util_env_replace 156
util_env_str 156
util_getline 157
util_hostname 157
util_is_mozilla 158
util_is_url 158
util_itoa 159
util_later_than 159
util_sh_escape 160
util_snprintf 160
util_strcasecmp 162
util_strncasecmp 162
util_uri_is_evil 163
util_uri_parse 164
util_uri_unescape 164
util_vsnprintf 164
util_vsprintf 165
util-sprintf 161
append-trailer
Service-class function 233
Archie, CGI and 25
AUTH_TYPE 39
authorization
steps for 80
translation, described 70
AuthTrans
directive, full description 223
functions and 80
REQ values and 81
step 70
auth-type function 224
auth-type parameter block variable 80
auth-user parameter block variable 80

B

BAD_REQUEST constant 168
basic-ncsa
AuthTrans-class function 223
boundaryCount variable 168
boundaryGen variable 168
boundaryStack variable 169
Bourne shell
accessing environment variables 35
buffer.h, described 94
bytes, value of sizefmt attribute 50

C

C and C++
accessing environment variables 35
C files
directories of 92
C shell
accessing environment variables 35
cache
enabling memory allocation pool 220
cache-init
Init-class function 221
CGI
activating 48
configuring the server to use 48
defined 19, 25
directories, specifying 48
file type, activating 48
MIME types 30
process, defined 26
programs 76
relationship to server 26, 27, 29
request process overview 26
security concerns 29
servers and 28
templates and 76
URLs and 31
user input and 32
cgi attribute of the exec command 52
CGI headers
generic 44
status codes in 46
CGI Object
obj.conf and 79
CGI process
decoding ISINDEX data 34
defined 26
described 28
environment variables and 28
CGI program
file access with extra path information 31
form data 33
images and 34
in a Java Applet 60
in ANSI C 61
in Perl 57
output and 43
responses and 29
sample output 47
starting with command-line arguments 42
CGI request
clients and 27
defined 28
CGI shell script sample 56
CGI specific headers 45
cgi-bin directory 30
characters, escaped 33
Chroot
directive 207
magnus.conf directive 207
cif_find
API function 103
cindex-ini
Init-class function 219
cinfo.h, described 94
cinfo_find
API function 103
Ciphers
magnus.conf directive 209
class
NameTrans functions 81
ObjectType functions 82
PathCheck functions 82
service functions 82
classes
functions and 80
functions passing data among 80
client
accessing CGI programs 26
CGI and 27
getting DNS name for 194
getting IP address for 194
HTTP header in variable 97
sending information to CGI 42
sessions and 193
client request
server handling process 70
cmd attribute of the exec command 52
code sample
directories of 92
code, compiling 100
command-line arguments 34
sending to CGI programs 42
comment line
mangus.conf and 74
Common Gateway Interface See CGI
common-log
Service-class function 238
compiling options 100
condvar_init
API function 104
condvar_notify
API function 104
condvar_terminate
API function 105
condvar_wait
API function 105
conf.h, described 95
config command 50
configuration files 199
constraint, server under 207
CONTENT_LENGTH 40
CONTENT_TYPE 40
Content-encoding header 45
Content-length header 44
Content-type header 44
conventions, used in this book 18
creating functions
described 92
overview 92
crit.h, described 94
crit_enter
API function 106
crit_exit
API function 106
crit_init
API function 106
crit_terminate
API function 107
custom functions
classes for 80
loading 101
using 102

D

daemon.h, described 94
daemon_atrestart
API function 107
data
sending to client from CGI program 43
structure, session variables for 193
DATE_GMT variable 52
DATE_LOCAL variable 52
decoding
automatically with ISINDEX 42
default object
obj.conf 79
default query handler 49
deny-existence
PathCheck-class function 228
directive
defined 74
directive syntax 77
directives
function classes and 80
functions and 91
magnus.conf 201
order in configuration files 70
directories
security and 30
specifying CGI 48
DNS
magnus.conf directive 208
DNS names
getting clients 194
dns-cache-init 222
document
variable for client request 97
DOCUMENT_NAME variable 52
DOCUMENT_URI variable 52
document-root 226
documents
file typing 230

E

echo command 51
encoding
form data and 33
URLs and 32
endMultipartResponse method 176
environment variables 34, 222
accessing 35
AUTH_TYPE 39
CONTENT_LENGTH 40
CONTENT_TYPE 40
formats of 36
GATEWAY_INTERFACE 37
HTTP_ACCEPT 41
HTTP_IF_MODIFIED_SINCE 41
HTTP_USER_AGENT 41
HTTPS 40
HTTPS_KEYSIZE 40
HTTPS_SECRETKEYSIZE 41
PATH_INFO 38
PATH_TRANSLATED 38
QUERY_STRING 38
REMOTE_ADDR 39
REMOTE_HOST 39
REMOTE_USER 40
REQUEST_METHOD 37
SCRIPT_NAME 38
SERVER_NAME 36
SERVER_PORT 37
SERVER_PROTOCOL 37
SERVER_SOFTWARE 36
SERVER_URL 36
ereport.h, described 94
errmsg attribute of config command 50
error
finding most recent system error 143
error codes 46
Error directive
Error
step 71
obj.conf 239
ErrorLog
magnus.conf directive 205
errors
reporting 98
reporting to log files 100
sending customized messages 239
setting response status codes 99
escaped characters 33
etc/passwd file, accessing with CGI 30
exec command 52
EXIT constant 181
Expires header 45
extra path information
in URL 31

F

fancy indexing 219
file attribute of include command 51
file descriptor
closing 144
locking 144
opening read-only 145
opening read-write 145
opening write-append 146
reading into a buffer 146
unlocking 149
writing from a buffer 147
writing without interruption 147
file name extension
mapping to MIME types 216
file types 231
file.h, described 94
filebuf_buf2sd
API function 108
filebuf_close
API function 108
filebuf_getc
API function 109
filebuf_open
API function 109
filebuf_open_nostat
API function 110
files
forcing type of 231
mapping types of 241
typing 230
typing by wildcard pattern 230
find-index
PathCheck-class function 227
find-links
PathCheck-class function 229
find-pathinfo
PathCheck-class function 229
flastmod command 51
affected by timefmt attribute 50
flexible logging 217
flex-init
Init-class function 217
flex-log
AddLog-class function 238
fonts
used in this book 18
FORBIDDEN constant 169
force-type
ObjectType-class function 231
form data
CGI and 32
encoding 33
format of 33
sending to CGI program 33
form elements
data passed to CGI 33
formData variable 169
forms
data sent to CGI 33
FREE
API function 110
fsize command 51
func.h, described 95
func_exec
API function 111
func_find
API function 111
function
configuration files and 72
responses for 72
return values and 72
used with directives 72
functions
classes for 80
creating for specific classes 80
directives and 91
handling data with pblocks 79, 95
header files for 93
initialization 83
loading in magnus.conf 101
NameTrans class 81
name-value pairs and 96
param_create 96
param_free 96
passing data between classes of 80
passing parameters among 79, 96
pblock_create 96
pblock_free 96
reporting errors in 98
request_header 98
response status codes 98
using in obj.conf 102

G

gateway
defined 25
GATEWAY_INTERFACE 37
GET
method 33, 232
sample of 57
getAddress method 180
getClientProperty method 183
getClientSocket method 183
getConfigProperty method 184
getFormData method 178
getFormField method 178
getHeader method 184
getInputStream method 184
getListeningAddress method 180
getListeningPort method 180
getMethod method 171
getOutputStream method 184
getPath method 172
getProtocol method 172
getQuery method 172
getRequestProperty method 185
getResponseProperty method 185
getServer method 185
getServerProperty method 186
getURI method 171
getURL method 172
GMT time
getting thread-safe value 148

H

handleRequest method 179, 186
hard links, finding 229
HEAD
method 232
header
variable for 97
header file
directories of 92
header files
described 93
home-page 227
hostname
CGI and 28
HP-UX, compiling for 101
HTTP headers 41
described 44
HTTP protocol
methods and 37
http.h, described 95
HTTP_ACCEPT 41
HTTP_USER_AGENT 41
HttpApplet
class, defined 168
constructor 171
HTTPS environment variable 40
HTTPS_KEYSIZE 40
HTTPS_SECRETKEYSIZE 41
HUP signal
Chroot and 207
PidLog and 205

I

icons
server internal (figure) 241
image, coordinates sent to CGI 34
imagemap 34
Service-class function 234
image-switch
ObjectType-class function 230
include command 51
includes, server side 50
index-common
Service-class function 234
indexing
fancy 219
index-simple
Service-class function 234
inform method 186
information
getting from clients 32
sending to server 42
Init
obj.conf directive 215
init-cgi 222
Init-class function 73, 83, 84, 222
initialization function 73, 83
initualizing for CGI 222
init-uhome
Init-class function 219
inode
server uses 217
input
standard 42
IP address
CGI and 28
getting clients 194
iponly function 238
IRIX, compiling for 101
isEvil method 189
ISINDEX 33
automatic decoding 34
CGI and 32
passed as command-line arguments 34
queries and 42
ISINDEX tag 49
ISMAP 34
CGI and 32

J

Java API 24, 167
Java applet
introduced 19
sample program 60
Java language 20
JavaScript language 21

K

key-toosmall
Error-class function 240
Service-class function 237

L

LAST_MODIFIED variable 52
linking options 100
list-dir
Service-class function 236
LoadObjects
magnus.conf directive 206
load-types
Init-class function 216
localtime
getting thread-safe value 148
local-types parameter 216
Location header 45
log analyzer 238
log file
analyzer for 238
log file 238
analyzer for 238
reporting errors to 100
log.h, described 95
log_error 100
API function 112
logging, flexible 217

M

magnus.conf
custom functions in 83
directives in 201
file,described 74
format of 74
loading shared objects 101
server configuration, described 69
magnus_atrestart
API function 113
make-dir
Service-class function 236
makefile 100
MALLOC
API function 113
MaxProcs
magnus.conf directive 203
MaxThreads
magnus.conf directive 204
memory allocation, pool-init Init-class function 220
method
determining 97
GET 37
POST 37
server and 232
MIME types 71
CGI and 30
mapping from file name extensions 216
typing files 230
MIME types icons (figure) 241
mime.types file 241
sample of 241
MIME-types parameter 216
MinThreads
magnus.conf directive 204
mmap (memory-mapped) files 221
mozilla-redirect 226

N

name translation
described 70
name variable 182
NameTrans 81
REQ values and 81
step 70
NameTrans directive
obj.conf 224
NameTrans-class function 226, 227
NameTrans-class functions
described 81
name-value pairs 33
functions for handling 96
net.h, described 94
net_ip2host
API function 114
net_read
API function 115
net_socket
API function 115
net_write
API function 116
netbuf_buf2sd
API function 116
netbuf_close
API function 117
netbuf_getc
API function 117
netbuf_grab
API function 117
netbuf_open
API function 118
Netscape servers
plug-in API and 18, 92
netsite.h, described 94
NO_RESPONSE constant 169
NOACTION constant 182
nonparsed headers
defined 43
NOT_FOUND constant 169
NOT_IMPLEMENTED constant 170
NOT_MODIFIED constant 170
nph- files (nonparsed headers), defined 43
NSAPI
directories of files 92

O

obj.conf
directives in 209
file, described 75
servicing requests and 69
structure of 76
using functions in 102
obj.conf file
required objects in 78
object
configuration 75
default,
specifying 206
servers and 70
types, MIME and 71
used to service client requests 70
object, defined 75
object.h, described 95
ObjectType
step 71
ObjectType directive
obj.conf 229
ObjectType-class functions 82
objset.h, described 95
OK constant 170
operating systems
compiling options and 100
OSF/1, compiling for 101
output
CGI and 29
sending to client 43

P

param_create
API function 96, 118
param_free
API function 96, 119
parameter block
described 79, 95
parameter block variable
auth-type 80
auth-user 80
parameters
passing 79, 96
parse-html
Service-class function 235
passing data to custom functions 96
passing parameters to functions 79, 96
passwords
Administration 243
path
absolute with Chroot directive 207
path check
described 71
path name
converting Unix-style to local 149
path translation 31
PATH_INFO 38
PATH_TRANSLATED 38
PathCheck
directive in obj.conf 227
step 71
PathCheck-class functions
described 82
pblock 79, 95
pblock.h, described 94
pblock_copy
API function 119
pblock_create 96
API function 120
pblock_dup
API function 120
pblock_find
API function 121
pblock_findval
API function 121
pblock_free
API function 96, 122
pblock_nninsert
API function 122
pblock_nvinsert
API function 123
pblock_pb2env
API function 124
pblock_pblock2str
API function 124
pblock_pinsert
API function 125
pblock_remove
API function 125
pblock_str2pblock
API function 126
Perl
accessing environment variables 35
detailed example 57
sample CGI program 57
PERM_FREE
API function 126
PERM_MALLOC
API function 127
PERM_STRDUP
API function 127
pfx2dir 225
NameTrans-class function 225
PidLog
magnus.conf directive 205
plug-in API
described 91
servers use of 92
Unix systems supported 91
port
magnus.conf directive 202
number request and 37
specifying 202
POST
method 33, 232
sample of 57
PROCEED constant 182
process
CGI and 27
processes
maximum number of 203
Prospero
CGI and 25
protocol
client and 97
protocol.h, described 95
protocol_dump822
API function 128
PROTOCOL_SERVER_ERROR 99
protocol_set_finfo
API function 128
protocol_start_response 83
API function 129
protocol_status 99
API function 130
protocol_uri2url
API function 131
protocol-related response headers 43
prototype for server application functions 79, 96

Q

queries
ISINDEX and 42
query handlers 49
query string
defined 31
QUERY_STRING 33
QUERY_STRING_UNESCAPED variable 52
query-handler
Service-class function 234

R

REALLOC
API function 132
record-useragent
Service-class function 239
redirect
NameTrans-class function 226
REDIRECT constant 170
REMOTE_ADDR 39
REMOTE_HOST 39
REMOTE_USER 40
remove-dir
Service-class function 236
remove-file
Service-class function 235
rename-file
Service-class function 237
reportCatastrophe method 187
reportFailure method 187
reportMisconfiguration method 187
reportSecurity method 187
req.h, described 95
REQ_ABORTED
AuthTrans and 81
NameTrans and 81
response code 72
Service and 83
REQ_EXIT
NameTrans and 82
response code 73
Service and 83
REQ_NOACTION
AuthTrans and 81
NameTrans and 81
response code 72
Service and 83
REQ_PROCEED
AuthTrans and 81
NameTrans and 81
response code 72
Service and 83
request response process 70
request variable 97
request_create
API function 133
request_free
API function 133
request_header function 98
REQUEST_METHOD 37
request_stat_path
API function 134
request_translate_uri
API function 135
request-header
API function 133
require-auth
PathCheck-class function 228
response process 83
response status codes
functions and 98
setting 99
responseStarted constant 182
returnErrorResponse method 174
two parameters 175
returnFile method
one parameter 174
two parameters 174
returnMultipartResponse method
one parameter 175
two parameters 176
returnNormalResponse method
one parameter 173
two parameters 173
RootObject
magnus.conf directive 206
run method 187

S

SAF, server application function
defined 72
sample
ANSI C 61
CGI in Perl 57
CGI shell script 56
Java Applet 60
using GET 57
using POST 57
sample object 77
sample program output 47
SCRIPT_NAME 38
Security
magnus.conf directive 208
security
CGI problems with 29
constraining the server 207
securityActive method 180
sem.h, described 94
sem_grab
API function 135
sem_init
API function 136
sem_release
API function 136
sem_terminate
API function 137
sem_tgrab
API function 137
semaphore
creating 136
deallocating 137
gaining exclusive access 135
releasing 136
testing for exclusive access 137
send-cgi
Service-class function 233
send-error
Service-class function 232
send-file
Service-class function 232
send-range
Service-class function 233
server
application function, defined 72
application functions,
prototype for 79
application functions, prototype for 96
bypassing 43
configuring for CGI 48
constraining 207
constraining of 207
decoding information 42
host name of 36
initializing 215
objects and 70
operation 69-89
process, CGI and 27
reporting errors to 98
URL for 36
version of 36
Server class
defined 179
Server Manager
CGI and 48-50
server variables 97
SERVER_ERROR constant 170
SERVER_NAME 36
SERVER_PORT 37
SERVER_PROTOCOL 37
SERVER_SOFTWARE 36
SERVER_URL 36
ServerApplet class
constructor 183
defined 181
ServerCert
magnus.conf directive 209
ServerKey
magnus.conf directive 208
ServerName
magnus.conf directive 202
server-parsed HTML 49
tags for 50
servers
CGI and 28
customizing 18, 92
HUP signal 205
killing process of 205
TERM signal 205
variables for 97
server-side includes 50
Service
step 71
Service directive
described 71
obj.conf 232
Service-class functions 82
session
defined 193
method used during 97
resolving the IP address of 138
session structure
creating 137
freeing 138
session variables 97
server variables 97
session.h, described 94
session_create
API function 137
session_free
API function 138
session_maxdns
API function 138
setContentType method 172
setFileInfo method 177
setResponseProperty method 188
setStatus method
one parameter 177
two parameters 177
setting response status codes 99
shared memory
allocating 142
freeing 142
shared objects
described 101
loading 101
shell expression
comparing (case-blind) to a string 139
comparing (case-sensitive) to a string 139, 141
validating 141
shexp.h, described 94
shexp_casecmp
API function 139
shexp_cmp
API function 139
shexp_match
API function 141
shexp_valid
API function 141
shmem_alloc
API function 142
shmem_free
API function 142
shtml-hacktype
ObjectType-class function 231
signatures
adding to files 53
sizefmt attribute of config command 50
socket
closing 117
opening connection to 115
reading from 115
sending a buffer to 116
sending file buffer to 108
writing to 116
socket constant 182
Solaris, compiling for 101
spaces, + as encoded 32
splitFormData method 190
splitting strings
C sample 64
sprintf, see <Italics>util_sprintf 161
standard input 34, 42
startResponse method 176
status codes 99
described 46
list of 46
Status header 46
STRDUP
API function 143
string
creating a copy of 143
styles, in this book 18
SunOS, compiling for 101
symbolic links
finding 229
system 149
system_errmsg
API function 143
system_fclose
API function 144
system_flock
API function 144
system_fopenRO
API function 145
system_fopenRW
API function 145
system_fopenWA
API function 146
system_fread
API function 146
system_fwrite
API function 147
system_fwrite_atomic
API function 147
system_gmtime
API function 148
system_localtime
API function 148
system_ulock
API function 149
system_unix2local
API function 149
systems.h, described 94
systhread_current
API function 150
systhread_getdata
API function 150
systhread_newkey
API function 151
systhread_setdata
API function 151
systhread_sleep
API function 152
systhread_start
API function 152
systhread_terminate
API function 152
systhread_timerset
API function 153

T

tags
server-parsed HTML 50
TERM signal 205
terms, in this book 18
thread
allocating a key for 151
creating 152
getting a pointer to 150
getting data belonging to 150
maximum number of 204
minimum number of 204
putting to sleep 152
setting data belonging to 151
setting interrupt timer 153
terminating 152
timefmt tag 50
tools, choosing 22
trailers
adding to files 53
translateURI method 177
type 231
type-by-exp
ObjectType-class function 230
type-by-extension
ObjectType-class function 230
typestyles used in this book 18

U

UNAUTHORIZED constant 170
Unix
constraining the server 207
systems supporting plug-in API 91
Unix user account
specifying 203
unix-home
NameTrans-class function 225
unix-uri-clean
PathCheck-class function 227
upload-file
Service-class function 235
URI
variable for 97
uri2url method 178
uriEscape method 190
URIUtil class
defined 188
URL
CGI and 30
CGI information in 31
embedding information in 31
encoding 32
mapping to other servers 225
translated to file path 70
URL decoding
C sample code 67
example code in C 67
example in Perl 59
urlEscape method 190
urlUnescape method 190
User
magnus.conf directive 203
user account
specifying 203
user authorization process 80
user home directories
symlinks and 229
util.h, described 94
util_can_exec
API function 153
util_chdir2path
API function 154
util_env_create
API function 154
util_env_find
API function 155
util_env_free
API function 155
util_env_replace
API function 156
util_env_str
API function 156
util_getline
API function 157
util_hostname
API function 157
util_is_mozilla
API function 158
util_is_url
API function 158
util_itoa
API function 159
util_later_than
API function 159
util_sh_escape
API function 160
util_snprintf
API function 160
util_sprintf
API function 161
util_strcasecmp
API function 162
util_strncasecmp
API function 162
util_uri_escape
API function 163
util_uri_is_evil
API function 163
util_uri_parse
API function 164
util_uri_unescape
API function 164
util_vsnprintf
API function 164
util_vsprintf
API function 165

V

value (in directives), defined 74
variable
client header 97
protocol 97
request information in 97
server 97
URI 97
variables
servers 97
virtual attribute of the include command 51
virtual path
defined 31
vsnprintf, see util_vsnprintf 164
vsprintf, see util_vsprintf 165

W

WAIS
CGI and 25
warn method 188
wildcard patterns
file typing and 230