docs.roxen.comBack to normal mode
DocsRoxenWebServer 6.1System Developer Manual PikeThe Roxen Module API
Copyright © 2019, Roxen Internet Software
Suggestions, comments & compliments
manuals@roxen.com

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 served by your virtual server passes through your filter module(s), you typically need to make sure your filter module does not interfere with such requests it was not intended to touch, or you may end up with some pretty hard to find problems.