Symbols

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

A

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

B

BAD_REQUEST constant 172
basic-auth
AuthTrans-class function 230
basic-ncsa
AuthTrans-class function 231
boundaryCount variable 172
boundaryGen variable 172
boundaryStack variable 173
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 93
C shell
accessing environment variables 36
cache
enabling memory allocation pool 227
cache-init
Init-class function 228
cert2user
PathCheck-class function 239
CGI
CGI-specific headers 46
configuring the server to use 49
defined 19, 25
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 45
status codes in 47
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 61
in ANSI C 62
in Perl 57
output and 44
responses and 29
sample output 48
starting with command-line arguments 43
CGI request
clients and 27
defined 28
CGI shell script sample 56
cgi-bin directory 30
characters, escaped 33
check-acl
PathCheck-class function 237
Chroot
directive 211
magnus.conf directive 211
cif_find
API function 105
cindex-ini
Init-class function 226
cinfo.h, described 94
cinfo_find
API function 105
Ciphers
magnus.conf directive 214
class
NameTrans functions 81
ObjectType functions 82
PathCheck functions 82
service functions 83
classes
functions and 80
functions passing data among 81
client
accessing CGI programs 26
CGI and 27
getting DNS name for 198
getting IP address for 198
HTTP header in variable 98
sending information to CGI 43
sessions and 197
client request
server handling process 70
cmd attribute of the exec command 52
code sample
directories of 93
code, compiling 101
command-line arguments 34
sending to CGI programs 43
comment line
mangus.conf and 74
Common Gateway Interface See CGI
common-log
Service-class function 248
compiling options 101
condvar_init
API function 106
condvar_notify
API function 106
condvar_terminate
API function 107
condvar_wait
API function 107
conf.h, described 95
config command 50
configuration files 203
constraint, server under 211
CONTENT_LENGTH 40
CONTENT_TYPE 40
Content-encoding header 46
Content-length header 45
Content-type header 45
conventions, used in this book 18
creating functions
described 92
overview 92
crit.h, described 94
crit_enter
API function 108
crit_exit
API function 108
crit_init
API function 108
crit_terminate
API function 109
custom functions
classes for 80
loading 102
using 103

D

daemon.h, described 94
daemon_atrestart
API function 109
data
sending to client from CGI program 44
structure, session variables for 197
DATE_GMT variable 52
DATE_LOCAL variable 52
decoding
automatically with ISINDEX 43
default object
obj.conf 79
deny-existence
PathCheck-class function 236
directive
defined 74
directive syntax 77
directives
function classes and 80
functions and 92
magnus.conf 205
order in configuration files 70
directories
security and 30
DNS
magnus.conf directive 212
DNS names
getting clients 198
dns-cache-init 229
document
variable for client request 98
DOCUMENT_NAME variable 52
DOCUMENT_URI variable 52
document-root 233
documents
file typing 240

E

echo command 51
encoding
form data and 33
URLs and 33
endMultipartResponse method 180
environment variables 34, 229
accessing 35
AUTH_TYPE 40
CONTENT_LENGTH 40
CONTENT_TYPE 40
formats of 36
GATEWAY_INTERFACE 37
HTTP_ACCEPT 42
HTTP_IF_MODIFIED_SINCE 42
HTTP_USER_AGENT 42
HTTPS 41
HTTPS_KEYSIZE 41
HTTPS_SECRETKEYSIZE 41
PATH_INFO 38
PATH_TRANSLATED 38
QUERY_STRING 39
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
directive 71
step 71
error codes 47
Error directive
obj.conf 249
ErrorLog
magnus.conf directive 209
errors
finding most recent system error 146
reporting 99
reporting to log files 101
sending customized messages 249
setting response status codes 100
escaped characters 33
etc/passwd file, accessing with CGI 30
exec command 52
EXIT constant 185
Expires header 45
extra path information
in URL 31

F

fancy indexing 226
file attribute of include command 51
file descriptor
closing 147
locking 147
opening read-only 148
opening read-write 148
opening write-append 149
reading into a buffer 149
unlocking 152, 153
writing from a buffer 150
writing without interruption 150
file name extension
mapping to MIME types 223
file types 241
file.h, described 94
filebuf_buf2sd
API function 110
filebuf_close
API function 110
filebuf_getc
API function 111
filebuf_open
API function 111
filebuf_open_nostat
API function 112
files
forcing type of 241
mapping types of 250
typing 240
typing by wildcard pattern 241
find-index
PathCheck-class function 235
find-links
PathCheck-class function 237
find-pathinfo
PathCheck-class function 237
flastmod command 51
affected by timefmt attribute 50
flexible logging 224
flex-init
Init-class function 224
flex-log
AddLog-class function 248
fonts
used in this book 18
FORBIDDEN constant 173
force-type
ObjectType-class function 241
form data
CGI and 32
encoding 33
format of 33
sending to CGI program 33
form elements
data passed to CGI 34
formData variable 173
forms
data sent to CGI 34
FREE
API function 113
fsize command 51
func.h, described 95
func_exec
API function 113
func_find
API function 114
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 92
handling data with pblocks 79, 96
header files for 94
initialization 84
loading in magnus.conf 102
NameTrans class 81
name-value pairs and 97
param_create 97
param_free 97
passing data between classes of 81
passing parameters among 79, 96
pblock_create 97
pblock_free 97
reporting errors in 99
request_header 99
response status codes 99
using in obj.conf 103

G

gateway
defined 25
GATEWAY_INTERFACE 37
GET
method 33, 242
sample of 57
getAddress method 184
get-client-cert
PathCheck-class function 238
getClientProperty method 187
getClientSocket method 187
getConfigProperty method 188
getFormData method 182
getFormField method 182
getHeader method 188
getInputStream method 188
getListeningAddress method 184
getListeningPort method 184
getMethod method 175
getOutputStream method 189
getPath method 176
getProtocol method 176
getQuery method 176
getRequestProperty method 189
getResponseProperty method 189
getServer method 190
getServerProperty method 190
getURI method 175
getURL method 176
GMT time
getting thread-safe value 151

H

handleRequest method 183, 190
hard links, finding 237
HEAD
method 242
header
variable for 98
header file
directories of 93
header files
described 94
home-page 234
hostname
CGI and 28
HP-UX, compiling for 102
HTTP headers 41
described 45
HTTP protocol
methods and 37
http.h, described 95
HTTP_ACCEPT 42
HTTP_USER_AGENT 42
HttpApplet
class, defined 172
constructor 175
HTTPS environment variable 41
HTTPS_KEYSIZE 41
HTTPS_SECRETKEYSIZE 41
HUP signal
Chroot and 212
PidLog and 210

I

icons
server internal (figure) 251
image, coordinates sent to CGI 34
imagemap 34
Service-class function 244
image-switch
ObjectType-class function 240
include command 51
includes, server side 50
index-common
Service-class function 245
indexing
fancy 226
index-simple
Service-class function 244
inform method 191
information
getting from clients 32
sending to server 43
Init
obj.conf directive 222
init-cgi 229
Init-class function 73, 84, 229
initialization function 73, 84
initializing for CGI 229
init-uhome
Init-class function 226
inode
server uses 224
input
standard 43
IP address
CGI and 28
getting clients 198
iponly function 248
IRIX, compiling for 102
isEvil method 193
ISINDEX 33
automatic decoding 34
CGI and 32
passed as command-line arguments 34
queries and 43
ISMAP 34
CGI and 32

J

Java API 24, 171
Java applet
introduced 19
sample program 61
Java language 20
JavaScript language 21

K

key-toosmall
Service-class function 247

L

LAST_MODIFIED variable 52
linking options 101
list-dir
Service-class function 246
load-config
PathCheck-class function 236
LoadObjects
magnus.conf directive 210
load-types
Init-class function 223
localtime
getting thread-safe value 151
local-types parameter 223
Location header 46
log analyzer 248
log file
analyzer for 248
log file 248
analyzer for 248
reporting errors to 101
log.h, described 95
log_error 101
API function 114
logging, flexible 224

M

magnus.conf
custom functions in 84
directives in 205
file,described 74
format of 74
loading shared objects 102
server configuration, described 69
magnus_atrestart
API function 115
make-dir
Service-class function 246
makefile 101
MALLOC
API function 116
MaxProcs
magnus.conf directive 208
MaxThreads
magnus.conf directive 209
memory allocation, pool-init Init-class function 227
method
determining 98
GET 37
POST 37
server and 242
MIME types 71
CGI and 30
mapping from file name extensions 223
typing files 240
MIME types icons (figure) 251
mime.types file 250
sample of 251
MIME-types parameter 223
MinThreads
magnus.conf directive 208
mmap (memory-mapped) files 228
mozilla-redirect 233

N

name translation
described 70
name variable 186
NameTrans 81
REQ values and 81
step 70
NameTrans directive
obj.conf 231
NameTrans-class function 233, 234
NameTrans-class functions
described 81
name-value pairs 33
functions for handling 97
net.h, described 94
net_ip2host
API function 116
net_read
API function 117
net_socket
API function 118
net_write
API function 118
netbuf_buf2sd
API function 119
netbuf_close
API function 119
netbuf_getc
API function 119
netbuf_grab
API function 120
netbuf_open
API function 120
Netscape servers
plug-in API and 18, 92
netsite.h, described 96
NO_RESPONSE constant 173
NOACTION constant 186
nonparsed headers
defined 44
NOT_FOUND constant 173
NOT_IMPLEMENTED constant 174
NOT_MODIFIED constant 174
nph- files (nonparsed headers), defined 44
NSAPI
directories of files 93

O

obj.conf
directives in 216
file, described 75
servicing requests and 69
structure of 76
using functions in 103
obj.conf file
required objects in 79
object
configuration 75
default,
specifying 211
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 240
ObjectType-class functions 82
objset.h, described 95
OK constant 174
operating systems
compiling options and 101
OSF/1, compiling for 102
output
CGI and 29
sending to client 44

P

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

Q

queries
ISINDEX and 43
query string
defined 32
QUERY_STRING 33
QUERY_STRING_UNESCAPED variable 52
query-handler
Service-class function 244

R

REALLOC
API function 135
record-useragent
Service-class function 249
redirect
NameTrans-class function 233
REDIRECT constant 174
regexp.h, described 95
REMOTE_ADDR 39
REMOTE_HOST 39
REMOTE_USER 40
remove-dir
Service-class function 247
remove-file
Service-class function 246
rename-file
Service-class function 247
reportCatastrophe method 191
reportFailure method 191
reportMisconfiguration method 191
reportSecurity method 191
req.h, described 95
REQ_ABORTED
AuthTrans and 81
NameTrans and 82
response code 72
Service and 83
REQ_EXIT
NameTrans and 82
response code 73
Service and 83
REQ_NOACTION
AuthTrans and 81
NameTrans and 82
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 98
request_create
API function 136
request_free
API function 136
request_header function 99
REQUEST_METHOD 37
request_stat_path
API function 137
request_translate_uri
API function 138
request-header
API function 136
require-auth
PathCheck-class function 235
response process 83
response status codes
functions and 99
setting 100
responseStarted constant 186
returnErrorResponse method 178
two parameters 179
returnFile method
one parameter 178
two parameters 178
returnMultipartResponse method
one parameter 179
two parameters 180
returnNormalResponse method
one parameter 177
two parameters 177
RootObject
magnus.conf directive 211
run method 192

S

SAF, server application function
defined 72
sample
ANSI C 62
CGI in Perl 57
CGI shell script 56
Java Applet 61
using GET 57
using POST 57
sample object 77
sample program output 48
SCRIPT_NAME 38
Security
magnus.conf directive 213
security
CGI problems with 29
constraining the server 211
securityActive method 184
sem.h, described 95
sem_grab
API function 138
sem_init
API function 139
sem_release
API function 139
sem_terminate
API function 139
sem_tgrab
API function 140
semaphore
creating 139
deallocating 139
gaining exclusive access 138
releasing 139
testing for exclusive access 140
send-cgi
Service-class function 244
send-error
Error-class function 250
Service-class function 243
send-file
Service-class function 242
send-range
Service-class function 243
server
application function, defined 72
application functions,
prototype for 80
application functions, prototype for 96
bypassing 44
configuring for CGI 49
constraining 211
constraining of 211
decoding information 43
host name of 36
initializing 222
objects and 70
operation 69-89
process, CGI and 28
reporting errors to 99
URL for 36
version of 36
Server class
defined 183
Server Manager
CGI and 49
server variables 98
SERVER_ERROR constant 174
SERVER_NAME 36
SERVER_PORT 37
SERVER_PROTOCOL 37
SERVER_SOFTWARE 36
SERVER_URL 36
ServerApplet class
constructor 187
defined 185
ServerCert
magnus.conf directive 214
ServerKey
magnus.conf directive 214
ServerName
magnus.conf directive 206
server-parsed HTML 49
tags for 50
servers
CGI and 28
customizing 18, 92
HUP signal 210
killing process of 210
TERM signal 210
variables for 98
server-side includes 50
Service
step 71
Service directive
described 71
obj.conf 242
Service-class functions 83
session
defined 197
method used during 98
resolving the IP address of 141
session structure
creating 140
freeing 141
session variables 98
server variables 98
session.h, described 95
session_create
API function 140
session_free
API function 141
session_maxdns
API function 141
setContentType method 176
setFileInfo method 181
setResponseProperty method 192
setStatus method
one parameter 181
two parameters 181
setting response status codes 100
shared memory
allocating 145
freeing 145
shared objects
described 102
loading 102
shell expression
comparing (case-blind) to a string 142
comparing (case-sensitive) to a string 142, 144
validating 144
shexp.h, described 95
shexp_casecmp
API function 142
shexp_cmp
API function 142
shexp_match
API function 144
shexp_valid
API function 144
shmem.h, described 95
shmem_alloc
API function 145
shmem_free
API function 145
shtml-hacktype
ObjectType-class function 241
signatures
adding to files 53
sizefmt attribute of config command 50
socket
closing 119
opening connection to 118
reading from 117
sending a buffer to 119
sending file buffer to 110
writing to 118
socket constant 186
Solaris, compiling for 102
spaces, + as encoded 33
splitFormData method 194
splitting strings
C sample 65
sprintf, see util_sprintf 165
SSL2
magnus.conf directive 213
SSL3Ciphers
magnus.conf directive 214
SSL3SessionTimeout
magnus.conf directive 215
SSLClientAuth
magnus.conf directive 216
SSLSessionTimeout
magnus.conf directive 215
standard input 34, 43
startResponse method 180
status codes 100
described 47
list of 47
Status header 47
STRDUP
API function 146
string
creating a copy of 146
styles, in this book 18
SunOS, compiling for 102
symbolic links
finding 237
system 153
system_errmsg
API function 146
system_fclose
API function 147
system_flock
API function 147
system_fopenRO
API function 148
system_fopenRW
API function 148
system_fopenWA
API function 149
system_fread
API function 149
system_fwrite
API function 150
system_fwrite_atomic
API function 150
system_gmtime
API function 151
system_localtime
API function 151
system_lseek
API function 152
system_rename
API function 153
system_ulock
API function 152, 153
system_unix2local
API function 153
systems.h, described 95
systhr.h, described 95
systhread_current
API function 154
systhread_getdata
API function 154
systhread_newkey
API function 155
systhread_setdata
API function 155
systhread_sleep
API function 156
systhread_start
API function 156
systhread_terminate
API function 157
systhread_timerset
API function 157

T

tags
server-parsed HTML 50
TERM signal 210
terms, in this book 18
thread
allocating a key for 155
creating 156
getting a pointer to 154
getting data belonging to 154
maximum number of 209
minimum number of 208
putting to sleep 156
setting data belonging to 155
setting interrupt timer 157
terminating 157
timefmt tag 50
tools, choosing 22
trailers
adding to files 53
translateURI method 181
type 241
type-by-exp
ObjectType-class function 241
type-by-extension
ObjectType-class function 240
typestyles used in this book 18

U

UNAUTHORIZED constant 174
Unix
constraining the server 211
systems supporting plug-in API 91
Unix user account
specifying 207
unix-home
NameTrans-class function 232
unix-uri-clean
PathCheck-class function 235
upload-file
Service-class function 245
URI
variable for 98
uri2url method 182
uriEscape method 194
URIUtil class
defined 193
URL
CGI and 30
CGI information in 31
embedding information in 31
encoding 33
mapping to other servers 232
translated to file path 70
URL decoding
C sample code 67
example code in C 67
example in Perl 59
urlEscape method 194
urlUnescape method 195
User
magnus.conf directive 207
user account
specifying 207
user authorization process 80
user home directories
symlinks and 237
util.h, described 95
util_can_exec
API function 157
util_chdir2path
API function 158
util_env_create
API function 158
util_env_find
API function 159
util_env_free
API function 159
util_env_replace
API function 160
util_env_str
API function 160
util_getline
API function 161
util_hostname
API function 161
util_is_mozilla
API function 162
util_is_url
API function 162
util_itoa
API function 163
util_later_than
API function 163
util_sh_escape
API function 164
util_snprintf
API function 164
util_sprintf
API function 165
util_strcasecmp
API function 166
util_strftime
API function 166
util_strncasecmp
API function 167
util_uri_escape
API function 167
util_uri_is_evil
API function 168
util_uri_parse
API function 168
util_uri_unescape
API function 169
util_vsnprintf
API function 169
util_vsprintf
API function 170

V

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

W

WAIS
CGI and 25
warn method 192
wildcard patterns
file typing and 241