Book Image

Lighttpd

By : Andre Bogus
Book Image

Lighttpd

By: Andre Bogus

Overview of this book

Table of Contents (20 chapters)
Lighttpd
Credits
About the Author
About the Reviewer
Preface
HTTP Status Codes

Handling Configuration


Most modules define a plugin_config data type, so they can re-use it from within the plugin_data type. For each selector clause, Lighttpd opens a new configuration context. Therefore, we need an array with one plugin_config for each context. This array will be filled by the mod_*_setdefaults function, and needs to be freed by the mod_*_free function. The usual configuration types are buffer and array, defined in buffer.h and array.h, respectively (we do not need to include them, as they are already included in base.h).

Let us just add some configuration to our example. Here is a selection of possible configuration values:

typedef struct {
unsigned short boolean_value; /* e.g. our.fun=enable */
unsigned short short_value; /* e.g. our.port=80 */
unsigned int int_value; /* wherever we may need one */
buffer *string_value; /* e.g. we.love="Lighttpd" */
array *array_value; /* e.g. our.array=("a", "b") or ("a"=>"b") */
/* be sure to include buffer.h and array.h */
} plugin_config...