docs.roxen.comView this page in a printer friendly mode
DocsRoxen2.1Programmer ManualThe Roxen Module API
Copyright © 2001, Roxen Internet Software
Suggestions, comments & compliments
manuals@roxen.com
 DEMO  DOCS  PIKE
 COMMUNITY  DOWNLOAD
www.roxen.com

   

Introduction to Roxen Modules
The Module Type Calling Sequence
Constants Common to All Modules
Callback Methods Common to All Modules
API Methods Common to All Modules
Module Variables
Tag Modules
Location (Filesystem) Modules
File Extension Modules
Filter Modules
Authentication Modules
Logger Modules
First Modules
Last Modules
Provider Modules
Content Type Modules
Directory Listing Modules

Filter Modules

Type MODULE_FILTER modules.
mapping|zero filter(mapping|zero result, RequestID id)

The filter() method is called for all requests just before the final resulting page is sent back to the browser, except when:

  • The reply for a request is found in the memory cache.

  • A module calls id->handle_reply() directly after accepting responsibility for the connection.

In effect, filter modules are essentially MODULE_LAST modules that get called for all requests, not only failed requests. The result parameter is either a zero (for an unhandled request) or a standard response mapping, as returned by any previous modules in the server. The id argument, as usual, is the request information object associated with the request.

The returned value is either zero, here signifying that you didn't rewrite or in any way alter the result mapping, or a new or changed result mapping.

Since all data server by your virtual server gets passed your filter module(s), you typically need to make sure your filter module doesn't interfere with such requests it wasn't intended to touch, or you may end up with some pretty hard to find problems.