Caching Proxy Help

API Request Processing

Overview of the API

The API interface gives you the ability to extend the proxy server's basic functions. By writing plug-ins (application extensions that you create) you can do customized processing like the following:

Basic server request process

The basic server request process can be broken up into steps based on the type of processing the server performs during that phase. Each step includes a juncture at which a specified part of your program can execute. By adding API directives to your configuration file, you indicate which of your application functions you want the server to call during a particular step. You can call several application functions during a request process step by including more than one of the API directives for that step.

Your compiled plug-in program is a .DLL, .so, or .o file, depending on your operating system. As the server proceeds through its request process steps, it calls the plug-in application functions associated with each step until one of the functions indicates it has handled the request. If more than one plug-in function is called from a particular step, they are called in the order in which they appear in the configuration file.

If the request is not completed by an application function (either no application function was specified, or the application function for that step returned the code HTTP_NOACTION), the server performs its default action for that step. Note: This is true for all steps except the Service step; the Service step does not have a default action.

API configuration directives

For each step in the request process, a configuration directive exists that allows you to specify a customized application function to be called and executed during that step.

API directive formats

ServerInit /path/file:function_name
PreExit /path/file:function_name
Authentication type /path/file:function_name
NameTrans /URL /path/file:function_name
Authorization /URL /path/file:function_name
ObjectType /URL /path/file:function_name
PostAuth /path/file:function_name
Service /URL /path/file:function_name
Transmogrifier /path/file:open_function_name:write_function_name:close_function_name:error_function_name
Log /URL /path/file:function_name
Error /URL /path/file:function_name
PostExit /path/file:function_name
ServerTerm /path/file:function_name
Midnight /path/file:function_name
PICSDBLookup /path/file:function_name
GC Advisor /path/file:function_name
Proxy Advisor /path/file:function_name

API directive variables

The variables in these directives have the following meanings:
type
(Used only with the Authentication directive.) This setting determines whether your application function will be called. Valid values are:
Basic
Application function is called only for basic authentication requests
*
Application function is called for all requests

/URL
This value determines for which URL requests your application function will be called. URL specifications in these directives are virtual (they do not include the protocol) but are preceded by a slash (/). For example, /www.ibm.com is correct but http://www.ibm.com is not. Valid values are:
A specific URL
Application function is called only for that URL
URL template
Application function is called only for URLs that match the template. You can specify a template as /URL*, /*, or *.

Note: A URL template is required with the Service directive if you want path translation to occur.


/path/file
The fully qualified file name of your compiled program
:function_name
The name you gave your application function within your program. In the Transmogrifier directive, you must supply the names of the open, write, and close functions.

Related information