docs.roxen.comView this page in a printer friendly mode
DocsRoxenWebServer 6.1System Developer Manual PikeImportant Classes
Copyright  2018, Roxen Internet Software
Suggestions, comments & compliments

Available Variable Types


The configuration object, reachable from the RequestID object via RequestID->configuration(), is Roxen WebServer's internal representation of a virtual server. Within it, you find all loaded modules, methods for them to interconnect to one another and various data about the server itself.

These are the member variables and methods of the Configuration object:

Server Info

int requests;

The number of requests, for debug and statistics info only.

int sent;

Bytes data sent.

int hsent;

Bytes headers sent.

int received;

Bytes data received.

mapping(string:RoxenModule) modules;

All enabled modules in this virtual server. The format is "module":{ "copies":([ num:instance, ... ]) }

mapping(RoxenModule:string) otomod;

A mapping from the module objects to module names.

int save_one( RoxenModule o )

Save all variables in a given module.

void save(int|void all)

Save this configuration. If all is included, save all configuration global variables as well, otherwise only all module variables.

int(0..1) is_file(string virt_path, RequestID id)

Is `virt_path' a file in our virtual filesystem?

int|string try_get_file(string s, RequestID id, int|void status, int|void nocache, int|void not_internal)

Convenience function used in quite a lot of modules. Tries to read a file into memory, and then returns the resulting string.


A 'file' can be a CGI script, which will be executed, resulting in a horrible delay.

Unless the not_internal flag is set, this tries to get an external or internal file. Here "internal" means a file that never should be sent directly as a request response. E.g. an internal redirect to a different file is still considered "external" since its contents is sent directly to the client. Internal requests are recognized by the id->misc->internal_get flag being non-zero.

string real_file(string file, RequestID id)

Return the _real_ filename of a virtual file, if any.

mapping get_file(RequestID id, int|void no_magic, int|void internal_get)

Return a result mapping for the id object at hand, mapping all modules, including the filter modules. This function is mostly a wrapper for low_get_file().

mapping|int(-1..0) low_get_file(RequestID id, int|void no_magic)

The function that actually tries to find the data requested. All modules except last and filter type modules are mapped, in order, and the first one that returns a suitable response is used. If 'no_magic' is set to one, the internal magic roxen images and the find_internal() callbacks will be ignored.

The return values 0 (no such file) and -1 (the data is a directory) are only returned when 'no_magic' was set to 1; otherwise a result mapping is always generated.

Inter-module Communication

array(string) userinfo(string u, RequestID|void id)

Fetches user information from the authentication module by calling its userinfo() method. Returns zero if no auth module was present.

array(string) userlist(RequestID|void id)

Fetches the full list of valid usernames from the authentication module by calling its userlist() method. Returns zero if no auth module was present.

array(string) user_from_uid(int u, RequestID|void id)

Return the user data for id u from the authentication module. The id parameter might be left out if FTP. Returns zero if no auth module was present.

mixed call_provider(string provides, string fun, mixed ... args)

Maps the function "fun" over all matching provider modules and returns the first positive response.

array(mixed) map_providers(string provides, string fun, mixed ... args)

Maps the function "fun" over all matching provider modules.

array(RoxenModule) get_providers(string provides)

Returns an array with all provider modules that provides "provides".

RoxenModule get_provider(string provides)

Returns the first provider module that provides "provides".

RoxenModule|string find_module(string name)

Return the module corresponding to the name (eg "rxmlparse", "rxmlparse#0" or "filesystem#1") or zero, if there was no such module.