Netscape Enterprise Server Programmer's Guide

Introduction

What are CGI and the server plug-in API?

Conventions used in this book

Chapter 1 Server programming overview

Comparison of server programming tools

Java and Java applets

JavaScript

Server plug-in API

Server application programming

CGI (Common Gateway Interface)

Server plug-in API

Java and JavaScript Server APIs

Chapter 2 CGI basics

The CGI request process in detail

The client sends the request

The server creates the CGI process

The server assigns variables and opens data paths

The CGI program responds to the client

Security concerns about CGI

Accessing CGI programs through URLs

Embedding information in URLs

Accepting user input from URLs

HTML form data

Input to an ISINDEX search dialog

ISMAP or imagemaps

Data the server sends to the CGI program

Accessing environment variables

Using Java Applets

Using C or C++

Using Perl

Using the Bourne shell

Using the C shell

Environment variables and their formats

SERVER_SOFTWARE

SERVER_NAME

SERVER_URL

GATEWAY_INTERFACE

SERVER_PROTOCOL

SERVER_PORT

REQUEST_METHOD

PATH_INFO

PATH_TRANSLATED

SCRIPT_NAME

QUERY_STRING

REMOTE_HOST

REMOTE_ADDR

AUTH_TYPE

REMOTE_USER

CONTENT_TYPE

CONTENT_LENGTH

Secure server variable formats

HTTPS

HTTPS_KEYSIZE

HTTPS_SECRETKEYSIZE

HTTP headers as environment variables

HTTP_ACCEPT

HTTP_USER_AGENT

HTTP_IF_MODIFIED_SINCE

Using standard input to get information

Sending command-line arguments

Sending output from CGI programs

Bypassing the server: nonparsed headers

CGI generic headers

Content-length

Content-type

Expires

Content-encoding

CGI-specific headers

Location

Status

Sample program output

Configuring your server to use CGI programs

Customizing server-parsed HTML

Server-parsed HTML commands

The config command

The include command

The echo command

The fsize command

The flastmod command

The exec command

Environment variables in commands

Adding signatures (trailers) to files

Chapter 3 Tips for developing CGI programs

A sample CGI shell script

A sample CGI program in Perl

A more detailed Perl example

A sample CGI program as a Java Applet

A sample CGI program in ANSI C

Chapter 4 Server operation

How the server handles client requests

What are server application functions?

Configuring the server

The magnus.conf file

Directive syntax

The obj.conf file

The structure of obj.conf

Required objects for obj.conf

Data in the server: the parameter block

Details for each directive/step

AuthTrans

NameTrans

PathCheck

ObjectType

Service

Initialization functions

Equivalents to CGI Environment Variables

Some new features in version 2.0

Threading

Caching

Software multihoming

Chapter 5 Creating server plug-in functions

What is the server plug-in API?

Writing plug-in functions

The server plug-in API header files

Getting data from the server: the parameter block

Passing parameters to server application functions

Parameter-manipulating functions

Data structures and data access functions

Application function status codes

Reporting errors to the server

Compiling and linking your code

Loading your shared object

Using your plug-in functions

Chapter 6 Server plug-in API function definitions

cinfo_find base/cinfo.h

condvar_init base/crit.h

condvar_notify base/crit.h

condvar_terminate base/crit.h

condvar_wait base/crit.h

crit_enter base/crit.h

crit_exit base/crit.h

crit_init base/crit.h

crit_terminate base/crit.h

daemon_atrestart netsite.h

filebuf_buf2sd base/buffer.h

filebuf_close base/buffer.h

filebuf_getc base/buffer.h

filebuf_open base/buffer.h

filebuf_open_nostat base/buffer.h

FREE netsite.h

func_exec frame/func.h

func_find frame/func.h

log_error frame/log.h

magnus_atrestart netsite.h

MALLOC netsite.h

net_ip2host base/net.h

net_read base/net.h

net_socket base/net.h

net_write base/net.h

netbuf_buf2sd base/buffer.h

netbuf_close base/buffer.h

netbuf_getc base/buffer.h

netbuf_grab base/buffer.h

netbuf_open base/buffer.h

param_create base/pblock.h

param_free base/pblock.h

pblock_copy base/pblock.h

pblock_create base/pblock.h

pblock_dup base/pblock.h

pblock_find base/pblock.h

pblock_findval base/pblock.h

pblock_free base/pblock.h

pblock_nninsert base/pblock.h

pblock_nvinsert base/pblock.h

pblock_pb2env base/pblock.h

pblock_pblock2str base/pblock.h

pblock_pinsert base/pblock.h

pblock_remove base/pblock.h

pblock_str2pblock base/pblock.h

PERM_FREE netsite.h

PERM_MALLOC netsite.h

PERM_STRDUP netsite.h

protocol_dump822 frame/protocol.h

protocol_set_finfo frame/protocol.h

protocol_start_response frame/protocol.h

protocol_status frame/protocol.h

protocol_uri2url frame/protocol.h

protocol_uri2url_dynamic frame/protocol.h

REALLOC netsite.h

request_create frame/req.h

request_free frame/req.h

request_header frame/req.h

request_stat_path frame/req.h

request_translate_uri frame/req.h

sem_grab base/sem.h

sem_init base/sem.h

sem_release base/sem.h

sem_terminate base/sem.h

sem_tgrab base/sem.h

session_create base/session.h

session_free base/session.h

session_maxdns base/session.h

shexp_casecmp base/shexp.h

shexp_cmp base/shexp.h

shexp_match base/shexp.h

shexp_valid base/shexp.h

shmem_alloc base/shmem.h

shmem_free base/shmem.h

STRDUP netsite.h

system_errmsg base/file.h

system_fclose base/file.h

system_flock base/file.h

system_fopenRO base/file.h

system_fopenRW base/file.h

system_fopenWA base/file.h

system_fread base/file.h

system_fwrite base/file.h

system_fwrite_atomic base/file.h

system_gmtime base/file.h

system_localtime base/file.h

system_lseek base/file.h

system_rename base/file.h

system_ulock base/file.h

system_unix2local base/file.h

systhread_current base/systhr.h

systhread_getdata base/systhr.h

systhread_newkey base/systhr.h

systhread_setdata base/systhr.h

systhread_sleep base/systhr.h

systhread_start base/systhr.h

systhread_terminate base/systhr.h

systhread_timerset base/systhr.h

util_can_exec base/util.h

util_chdir2path base/util.h

util_env_create base/util.h

util_env_find base/util.h

util_env_free base/util.h

util_env_replace base/util.h

util_env_str base/util.h

util_getline base/util.h

util_hostname base/util.h

util_is_mozilla base/util.h

util_is_url base/util.h

util_itoa base/util.h

util_later_than base/util.h

util_sh_escape base/util.h

util_snprintf base/util.h

util_sprintf base/util.h

util_strcasecmp base/systems.h

util_strftime base/util.h

util_strncasecmp base/systems.h

util_uri_escape base/util.h

util_uri_is_evil base/util.h

util_uri_parse base/util.h

util_uri_unescape base/util.h

util_vsnprintf base/util.h

util_vsprintf base/util.h

Chapter 7 Java API

Class netscape.server.applet.HttpApplet

Variables

BAD_REQUEST

boundaryCount

boundaryGen

boundaryStack

FORBIDDEN

formData

NO_RESPONSE

NOT_FOUND

NOT_IMPLEMENTED

NOT_MODIFIED

OK

REDIRECT

SERVER_ERROR

UNAUTHORIZED

Constructor

public HttpApplet()

Methods

getMethod

getURI

getProtocol

getQuery

getPath

setContentType

getURL

returnNormalResponse--one parameter

returnNormalResponse--two parameters

returnFile--two parameters

returnFile--one parameter

returnErrorResponse--three parameters

returnErrorResponse--two parameters

returnMultipartResponse--one parameter

returnMultipartResponse--two parameters

endMultipartResponse

startResponse

setStatus--two parameters

setStatus--one parameter

setFileInfo

translateURI

uri2url

getFormData

getFormField

handleRequest

Class netscape.server.applet.Server

Variables

Methods

getAddress

getListeningAddress

getListeningPort

securityActive

Class netscape.server.applet.ServerApplet

Variables

ABORTED

EXIT

name

NOACTION

PROCEED

responseStarted

socket

Constructor

ServerApplet

Methods

getClientSocket

getClientProperty

getConfigProperty

getHeader

getInputStream

getOutputStream

getRequestProperty

getResponseProperty

getServer

getServerProperty

handleRequest

inform

reportMisconfiguration

reportCatastrophe

reportFailure

reportSecurity

run

setResponseProperty

warn

Class netscape.server.applet.URIUtil

Variables

Methods

isEvil

splitFormData

uriEscape

urlEscape

urlUnescape

Appendix A Server data structures

The Session data structure

The parameter block (pblock) data structure

The Client parameter block

The Request data structure

The stat data structure

The shared memory structure shmem_s

The netbuf data structure

The filebuffer data structure

The cinfo data structure

The SYS_NETFD data structure

The SYS_FILE data structure

The SEMAPHORE data structure

The sockaddr_in data structure

The CONDVAR data structure

The CRITICAL data structure

The SYS_THREAD data structure

Appendix B Server configuration files

Syntax

Case sensitivity

Separators

Quotes

Spaces

Comments

Line continuation

Directives in magnus.conf

ServerName directive

Port directive

User directive

MaxProcs directive

MinThreads directive

MaxThreads directive

ErrorLog directive

PidLog directive

LoadObjects directive

RootObject directive

Chroot directive

DNS directive

Security directive

SSL2 directive

SSL3 directive

ServerKey directive

ServerCert directive

Ciphers directive

SSL3Ciphers directive

ACLFile directive

SSLSessionTimeout directive

SSL3SessionTimeout directive

SSLClientAuth directive

Directives in obj.conf

Summaries of the obj.conf directives

Init directive

load-types function

init-clf

flex-init function

init-uhome function

cindex-init function

pool-init function

cache-init function

dns-cache-init function

init-cgi function

AuthTrans Directive

basic-auth function

basic-ncsa function

NameTrans directive

pfx2dir function

unix-home function

document-root function

redirect function

mozilla-redirect function

home-page function

assign-name function

PathCheck directive

unix-uri-clean function

find-index function

require-auth function

load-config function

deny-existence function

find-links function

find-pathinfo function

check-acl function

get-client-cert function

cert2user function

ObjectType directive

type-by-extension function

image-switch function

type-by-exp function

force-type function

shtml-hacktype function

Service directive

send-file function

send-error function

send-range function

append-trailer function

send-cgi function

query-handler function

imagemap function

index-simple function

index-common function

parse-html function

upload-file function

remove-file function

list-dir function

make-dir function

remove-dir function

rename-file function

key-toosmall function

AddLog directive

common-log function

flex-log function

record-useragent function

Error directive

send-error function

The mime.types file

The admpw file

Index



Legal Page

Copyright © 1996, Netscape Communications Corporation. All rights reserved.