Name
Header Parser
Synopsis
int module_header_parser(request_rec *pReq)
This routine is similar in intent to the
post_read_request
phase. It can return
OK
, DECLINED
, or a status code.
If something other than DECLINED
is returned, no
further modules are called. The intention was to make decisions based
on the headers sent by the client. However, its use has (in most
cases) been superseded by post_read_request
. Since
it occurs after the per-directory configuration merge has been done,
it is useful in some cases.
The only standard module that uses it is mod_setenvif.c, as shown in Example 21-16.
Example
static int match_headers(request_rec *r) { sei_cfg_rec *sconf; sei_entry *entries; table_entry *elts; const char *val; int i, j; int perdir; char *last_name; perdir = (ap_table_get(r->notes, SEI_MAGIC_HEIRLOOM) != NULL); if (! perdir) { ap_table_set(r->notes, SEI_MAGIC_HEIRLOOM, "post-read done"); sconf = (sei_cfg_rec *) ap_get_module_config(r->server->module_config, &setenvif_module); } else { sconf = (sei_cfg_rec *) ap_get_module_config(r->per_dir_config, &setenvif_module); } entries = (sei_entry *) sconf->conditionals->elts; last_name = NULL; val = NULL; for (i = 0; i < sconf->conditionals->nelts; ++i) { sei_entry *b = &entries[i]; /* Optimize the case where a bunch of directives in a row use the * same header. Remember we don't need to strcmp the two header * names because we made sure the pointers were equal during * configuration. */ if (b->name != ...
Get Apache: The Definitive Guide, 3rd Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.