]> granicus.if.org Git - apache/blob - modules/metadata/mod_headers.c
Implement "Early" mode in mod_headers, and document it.
[apache] / modules / metadata / mod_headers.c
1 /* Copyright 1999-2004 The Apache Software Foundation
2  *
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15
16 /*
17  * mod_headers.c: Add/append/remove HTTP response headers
18  *     Written by Paul Sutton, paul@ukweb.com, 1 Oct 1996
19  *
20  * The Header directive can be used to add/replace/remove HTTP headers
21  * within the response message.  The RequestHeader directive can be used
22  * to add/replace/remove HTTP headers before a request message is processed.
23  * Valid in both per-server and per-dir configurations.
24  *
25  * Syntax is:
26  *
27  *   Header action header value
28  *   RequestHeader action header value
29  *
30  * Where action is one of:
31  *     set    - set this header, replacing any old value
32  *     add    - add this header, possible resulting in two or more
33  *              headers with the same name
34  *     append - append this text onto any existing header of this same
35  *     unset  - remove this header
36  *
37  * Where action is unset, the third argument (value) should not be given.
38  * The header name can include the colon, or not.
39  *
40  * The Header and RequestHeader directives can only be used where allowed
41  * by the FileInfo override.
42  *
43  * When the request is processed, the header directives are processed in
44  * this order: firstly, the main server, then the virtual server handling
45  * this request (if any), then any <Directory> sections (working downwards 
46  * from the root dir), then an <Location> sections (working down from 
47  * shortest URL component), the any <File> sections. This order is
48  * important if any 'set' or 'unset' actions are used. For example,
49  * the following two directives have different effect if applied in
50  * the reverse order:
51  *
52  *   Header append Author "John P. Doe"
53  *   Header unset Author
54  *
55  * Examples:
56  *
57  *  To set the "Author" header, use
58  *     Header add Author "John P. Doe"
59  *
60  *  To remove a header:
61  *     Header unset Author
62  *
63  */
64
65 #include "apr.h"
66 #include "apr_lib.h"
67 #include "apr_strings.h"
68 #include "apr_buckets.h"
69
70 #include "apr_hash.h"
71 #define APR_WANT_STRFUNC
72 #include "apr_want.h"
73
74 #include "httpd.h"
75 #include "http_config.h"
76 #include "http_request.h"
77 #include "http_log.h"
78 #include "util_filter.h"
79 #include "http_protocol.h"
80
81 #include "mod_ssl.h" /* for the ssl_var_lookup optional function defn */
82
83 /* format_tag_hash is initialized during pre-config */
84 static apr_hash_t *format_tag_hash;
85
86 typedef enum {
87     hdr_add = 'a',              /* add header (could mean multiple hdrs) */
88     hdr_set = 's',              /* set (replace old value) */
89     hdr_append = 'm',           /* append (merge into any old value) */
90     hdr_unset = 'u',            /* unset header */
91     hdr_echo = 'e'              /* echo headers from request to response */
92 } hdr_actions;
93
94 /*
95  * magic cmd->info values
96  */
97 static char hdr_in  = '0';  /* RequestHeader */
98 static char hdr_out = '1';  /* Header onsuccess */
99 static char hdr_err = '2';  /* Header always */
100
101 /*
102  * There is an array of struct format_tag per Header/RequestHeader 
103  * config directive
104  */
105 typedef struct {
106     const char* (*func)(request_rec *r,char *arg);
107     char *arg;
108 } format_tag;
109
110 /* 'Magic' condition_var value to run action in post_read_request */
111 static const char* condition_early = "early";
112 /*
113  * There is one "header_entry" per Header/RequestHeader config directive
114  */
115 typedef struct {
116     hdr_actions action;
117     const char *header;
118     apr_array_header_t *ta;   /* Array of format_tag structs */
119     regex_t *regex;
120     const char *condition_var;
121 } header_entry;
122
123 /* echo_do is used for Header echo to iterate through the request headers*/
124 typedef struct {
125     request_rec *r;
126     header_entry *hdr;
127 } echo_do;
128
129 /*
130  * headers_conf is our per-module configuration. This is used as both
131  * a per-dir and per-server config
132  */
133 typedef struct {
134     apr_array_header_t *fixup_in;
135     apr_array_header_t *fixup_out;
136     apr_array_header_t *fixup_err;
137 } headers_conf;
138
139 module AP_MODULE_DECLARE_DATA headers_module;
140
141 /* Pointer to ssl_var_lookup, if available. */
142 static APR_OPTIONAL_FN_TYPE(ssl_var_lookup) *header_ssl_lookup = NULL;
143
144 /*
145  * Tag formatting functions
146  */
147 static const char *constant_item(request_rec *r, char *stuff)
148 {
149     return stuff;
150 }
151 static const char *header_request_duration(request_rec *r, char *a)
152 {
153     return apr_psprintf(r->pool, "D=%" APR_TIME_T_FMT, 
154                         (apr_time_now() - r->request_time)); 
155 }
156 static const char *header_request_time(request_rec *r, char *a)
157 {
158     return apr_psprintf(r->pool, "t=%" APR_TIME_T_FMT, r->request_time);
159 }
160
161 /* unwrap_header returns HDR with any newlines converted into
162  * whitespace if necessary. */
163 static const char *unwrap_header(apr_pool_t *p, const char *hdr)
164 {
165     if (ap_strchr_c(hdr, APR_ASCII_LF) || ap_strchr_c(hdr, APR_ASCII_CR)) {
166         char *ptr;
167         
168         hdr = ptr = apr_pstrdup(p, hdr);
169         
170         do {
171             if (*ptr == APR_ASCII_LF || *ptr == APR_ASCII_CR)
172                 *ptr = APR_ASCII_BLANK;
173         } while (*ptr++);
174     }
175     return hdr;
176 }
177
178 static const char *header_request_env_var(request_rec *r, char *a)
179 {
180     const char *s = apr_table_get(r->subprocess_env,a);
181
182     if (s)
183         return unwrap_header(r->pool, s);
184     else
185         return "(null)";
186 }
187
188 static const char *header_request_ssl_var(request_rec *r, char *name)
189 {
190     if (header_ssl_lookup) {
191         const char *val = header_ssl_lookup(r->pool, r->server, 
192                                             r->connection, r, name);
193         if (val && val[0])
194             return unwrap_header(r->pool, val);
195         else
196             return "(null)";
197     }
198     else {
199         return "(null)";
200     }
201 }
202
203 /*
204  * Config routines
205  */
206
207 static void *create_headers_dir_config(apr_pool_t *p, char *d)
208 {
209     headers_conf *conf = apr_pcalloc(p, sizeof(*conf));
210
211     conf->fixup_in = apr_array_make(p, 2, sizeof(header_entry));
212     conf->fixup_out = apr_array_make(p, 2, sizeof(header_entry));
213     conf->fixup_err = apr_array_make(p, 2, sizeof(header_entry));
214
215     return conf;
216 }
217
218 static void *merge_headers_config(apr_pool_t *p, void *basev, void *overridesv)
219 {
220     headers_conf *newconf = apr_pcalloc(p, sizeof(*newconf));
221     headers_conf *base = basev;
222     headers_conf *overrides = overridesv;
223
224     newconf->fixup_in = apr_array_append(p, base->fixup_in,
225                                          overrides->fixup_in);
226     newconf->fixup_out = apr_array_append(p, base->fixup_out,
227                                           overrides->fixup_out);
228     newconf->fixup_err = apr_array_append(p, base->fixup_err,
229                                           overrides->fixup_err);
230
231     return newconf;
232 }
233  
234 static char *parse_misc_string(apr_pool_t *p, format_tag *tag, const char **sa)
235 {
236     const char *s;
237     char *d;
238
239     tag->func = constant_item;
240
241     s = *sa;
242     while (*s && *s != '%') {
243         s++;
244     }
245     /*
246      * This might allocate a few chars extra if there's a backslash
247      * escape in the format string.
248      */
249     tag->arg = apr_palloc(p, s - *sa + 1);
250
251     d = tag->arg;
252     s = *sa;
253     while (*s && *s != '%') {
254         if (*s != '\\') {
255             *d++ = *s++;
256         }
257         else {
258             s++;
259             switch (*s) {
260             case '\\':
261                 *d++ = '\\';
262                 s++;
263                 break;
264             case 'r':
265                 *d++ = '\r';
266                 s++;
267                 break;
268             case 'n':
269                 *d++ = '\n';
270                 s++;
271                 break;
272             case 't':   
273                 *d++ = '\t';
274                 s++;
275                 break;
276             default:
277                 /* copy verbatim */
278                 *d++ = '\\';
279                 /*
280                  * Allow the loop to deal with this *s in the normal
281                  * fashion so that it handles end of string etc.
282                  * properly.
283                  */
284                 break;
285             }
286         }
287     }
288     *d = '\0';
289
290     *sa = s;
291     return NULL;
292 }
293
294 static char *parse_format_tag(apr_pool_t *p, format_tag *tag, const char **sa)
295
296     const char *s = *sa;
297     const char * (*tag_handler)(request_rec *,char *);
298
299     /* Handle string literal/conditionals */
300     if (*s != '%') {
301         return parse_misc_string(p, tag, sa);
302     }
303     s++; /* skip the % */
304
305     /* Pass through %% as % */
306     if (*s == '%') {
307         tag->func = constant_item;
308         tag->arg = "%";
309         *sa = ++s;
310         return NULL;
311     }
312
313     tag->arg = '\0';
314     /* grab the argument if there is one */
315     if (*s == '{') {
316         ++s;
317         tag->arg = ap_getword(p,&s,'}');
318     }
319
320     tag_handler = (const char * (*)(request_rec *,char *))apr_hash_get(format_tag_hash, s++, 1);
321
322     if (!tag_handler) {
323         char dummy[2];
324         dummy[0] = s[-1];
325         dummy[1] = '\0';
326         return apr_pstrcat(p, "Unrecognized header format %", dummy, NULL);
327     }
328     tag->func = tag_handler;
329
330     *sa = s;
331     return NULL;
332 }
333
334 /*
335  * A format string consists of white space, text and optional format 
336  * tags in any order. E.g., 
337  *
338  * Header add MyHeader "Free form text %D %t more text"
339  *
340  * Decompose the format string into its tags. Each tag (struct format_tag)
341  * contains a pointer to the function used to format the tag. Then save each 
342  * tag in the tag array anchored in the header_entry.
343  */
344 static char *parse_format_string(apr_pool_t *p, header_entry *hdr, const char *s)
345 {
346     char *res;
347
348     /* No string to parse with unset and echo commands */
349     if (hdr->action == hdr_unset ||
350         hdr->action == hdr_echo) {
351         return NULL;
352     }
353
354     hdr->ta = apr_array_make(p, 10, sizeof(format_tag));
355
356     while (*s) {
357         if ((res = parse_format_tag(p, (format_tag *) apr_array_push(hdr->ta), &s))) {
358             return res;
359         }
360     }
361     return NULL;
362 }
363
364 /* handle RequestHeader and Header directive */
365 static APR_INLINE const char *header_inout_cmd(cmd_parms *cmd,
366                                                void *indirconf,
367                                                const char *action,
368                                                const char *hdr,
369                                                const char *value,
370                                                const char* envclause)
371 {
372     headers_conf *dirconf = indirconf;
373     const char *condition_var = NULL;
374     const char *colon;
375     header_entry *new;
376
377     apr_array_header_t *fixup = (cmd->info == &hdr_in)
378         ? dirconf->fixup_in   : (cmd->info == &hdr_err)
379         ? dirconf->fixup_err
380         : dirconf->fixup_out;
381
382     new = (header_entry *) apr_array_push(fixup);
383
384     if (!strcasecmp(action, "set"))
385         new->action = hdr_set;
386     else if (!strcasecmp(action, "add"))
387         new->action = hdr_add;
388     else if (!strcasecmp(action, "append"))
389         new->action = hdr_append;
390     else if (!strcasecmp(action, "unset"))
391         new->action = hdr_unset;
392     else if (!strcasecmp(action, "echo"))
393         new->action = hdr_echo;
394     else
395         return "first argument must be 'add', 'set', 'append', 'unset' or "
396                "'echo'.";
397
398     if (new->action == hdr_unset) {
399         if (value) {
400             if (envclause) {
401                 return "header unset takes two arguments";
402             }
403             envclause = value;
404             value = NULL;
405         }
406     }
407     else if (new->action == hdr_echo) {
408         regex_t *regex;
409
410         if (value) {
411             if (envclause) {
412                 return "Header echo takes two arguments";
413             }
414             envclause = value;
415             value = NULL;
416         }
417         if (cmd->info != &hdr_out && cmd->info != &hdr_err)
418             return "Header echo only valid on Header "
419                    "directives";
420         else {
421             regex = ap_pregcomp(cmd->pool, hdr, REG_EXTENDED | REG_NOSUB);
422             if (regex == NULL) {
423                 return "Header echo regex could not be compiled";
424             }
425         }
426         new->regex = regex;
427     }
428     else if (!value)
429         return "Header requires three arguments";
430
431     /* Handle the envclause on Header */
432     if (envclause != NULL) {
433         if (strcasecmp(envclause, "early") == 0) {
434             condition_var = condition_early;
435         }
436         else {
437             if (strncasecmp(envclause, "env=", 4) != 0) {
438                 return "error: envclause should be in the form env=envar";
439             }
440             if ((envclause[4] == '\0')
441                 || ((envclause[4] == '!') && (envclause[5] == '\0'))) {
442                 return "error: missing environment variable name. "
443                     "envclause should be in the form env=envar ";
444             }
445             condition_var = envclause + 4;
446         }
447     }
448     
449     if ((colon = ap_strchr_c(hdr, ':'))) {
450         hdr = apr_pstrmemdup(cmd->pool, hdr, colon-hdr);
451     }
452
453     new->header = hdr;
454     new->condition_var = condition_var;
455
456     return parse_format_string(cmd->pool, new, value);
457 }
458
459 /* Handle all (xxx)Header directives */
460 static const char *header_cmd(cmd_parms *cmd, void *indirconf,
461                               const char *args)
462 {
463     const char *action;
464     const char *hdr;
465     const char *val;
466     const char *envclause;
467
468     action = ap_getword_conf(cmd->pool, &args);
469     if (cmd->info == &hdr_out) {
470         if (!strcasecmp(action, "always")) {
471             cmd->info = &hdr_err;
472             action = ap_getword_conf(cmd->pool, &args);
473         }
474         else if (!strcasecmp(action, "onsuccess")) {
475             action = ap_getword_conf(cmd->pool, &args);
476         }
477     }
478     hdr = ap_getword_conf(cmd->pool, &args);
479     val = *args ? ap_getword_conf(cmd->pool, &args) : NULL;
480     envclause = *args ? ap_getword_conf(cmd->pool, &args) : NULL;
481
482     if (*args) {
483         return apr_pstrcat(cmd->pool, cmd->cmd->name,
484                            " has too many arguments", NULL);
485     }
486
487     return header_inout_cmd(cmd, indirconf, action, hdr, val, envclause);
488 }
489
490 /*
491  * Process the tags in the format string. Tags may be format specifiers 
492  * (%D, %t, etc.), whitespace or text strings. For each tag, run the handler
493  * (formatter) specific to the tag. Handlers return text strings.
494  * Concatenate the return from each handler into one string that is 
495  * returned from this call.
496  */
497 static char* process_tags(header_entry *hdr, request_rec *r) 
498 {
499     int i;
500     const char *s;
501     char *str = NULL;
502
503     format_tag *tag = (format_tag*) hdr->ta->elts;
504  
505     for (i = 0; i < hdr->ta->nelts; i++) {
506         s = tag[i].func(r, tag[i].arg);
507         if (str == NULL) 
508             str = apr_pstrdup(r->pool, s);
509         else
510             str = apr_pstrcat(r->pool, str, s, NULL);
511     }
512     return str ? str : "";
513 }
514
515 static int echo_header(echo_do *v, const char *key, const char *val)
516 {
517     /* If the input header (key) matches the regex, echo it intact to 
518      * r->headers_out.
519      */
520     if (!ap_regexec(v->hdr->regex, key, 0, NULL, 0)) {
521         apr_table_add(v->r->headers_out, key, val);
522     }
523
524     return 1;
525 }
526
527 static void do_headers_fixup(request_rec *r, apr_table_t *headers,
528                              apr_array_header_t *fixup, int early)
529 {
530     int i;
531
532     for (i = 0; i < fixup->nelts; ++i) {
533         header_entry *hdr = &((header_entry *) (fixup->elts))[i];
534         const char *envar = hdr->condition_var;
535
536         /* ignore early headers in late calls */
537         if (!early && (envar == condition_early)) {
538             continue;
539         }
540         /* ignore late headers in early calls */
541         else if (early && (envar != condition_early)) {
542             continue;
543         }
544         /* Have any conditional envar-controlled Header processing to do? */
545         else if (envar && !early) {
546             if (*envar != '!') {
547                 if (apr_table_get(r->subprocess_env, envar) == NULL)
548                     continue;
549             }
550             else {
551                 if (apr_table_get(r->subprocess_env, &envar[1]) != NULL)
552                     continue;
553             }
554         }
555
556         switch (hdr->action) {
557         case hdr_add:
558             apr_table_addn(headers, hdr->header, process_tags(hdr, r));
559             break;
560         case hdr_append:
561             apr_table_mergen(headers, hdr->header, process_tags(hdr, r));
562             break;
563         case hdr_set:
564             apr_table_setn(headers, hdr->header, process_tags(hdr, r));
565             break;
566         case hdr_unset:
567             apr_table_unset(headers, hdr->header);
568             break;
569         case hdr_echo:
570         {
571             echo_do v;
572             v.r = r;
573             v.hdr = hdr;
574             apr_table_do((int (*) (void *, const char *, const char *)) 
575                          echo_header, (void *) &v, r->headers_in, NULL);
576             break;
577         }
578         }
579     }
580 }
581
582 static void ap_headers_insert_output_filter(request_rec *r)
583 {
584     headers_conf *dirconf = ap_get_module_config(r->per_dir_config,
585                                                  &headers_module);
586
587     if (dirconf->fixup_out->nelts || dirconf->fixup_err->nelts) {
588         ap_add_output_filter("FIXUP_HEADERS_OUT", NULL, r, r->connection);
589     }
590 }
591
592 /*
593  * Make sure our error-path filter is in place.
594  */
595 static void ap_headers_insert_error_filter(request_rec *r)
596 {
597     headers_conf *dirconf = ap_get_module_config(r->per_dir_config,
598                                                  &headers_module);
599
600     if (dirconf->fixup_err->nelts) {
601         ap_add_output_filter("FIXUP_HEADERS_ERR", NULL, r, r->connection);
602     }
603 }
604
605 static apr_status_t ap_headers_output_filter(ap_filter_t *f,
606                                              apr_bucket_brigade *in)
607 {
608     headers_conf *dirconf = ap_get_module_config(f->r->per_dir_config,
609                                                  &headers_module);
610
611     ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, f->r->server,
612                  "headers: ap_headers_output_filter()");
613
614     /* do the fixup */
615     do_headers_fixup(f->r, f->r->err_headers_out, dirconf->fixup_err, 0);
616     do_headers_fixup(f->r, f->r->headers_out, dirconf->fixup_out, 0);
617
618     /* remove ourselves from the filter chain */
619     ap_remove_output_filter(f);
620
621     /* send the data up the stack */
622     return ap_pass_brigade(f->next,in);
623 }
624
625 /*
626  * Make sure we propagate any "Header always" settings on the error
627  * path through http_protocol.c.
628  */
629 static apr_status_t ap_headers_error_filter(ap_filter_t *f,
630                                             apr_bucket_brigade *in)
631 {
632     headers_conf *dirconf;
633
634     dirconf = ap_get_module_config(f->r->per_dir_config,
635                                     &headers_module);
636     ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, f->r->server,
637                  "headers: ap_headers_error_filter()");
638
639     /*
640      * Add any header fields defined by "Header always" to r->err_headers_out.
641      * Server-wide first, then per-directory to allow overriding.
642      */
643     do_headers_fixup(f->r, f->r->err_headers_out, dirconf->fixup_err, 0);
644
645     /*
646      * We've done our bit; remove ourself from the filter chain so there's
647      * no possibility we'll be called again.
648      */
649     ap_remove_output_filter(f);
650
651     /*
652      * Pass the buck.  (euro?)
653      */
654     return ap_pass_brigade(f->next, in);
655 }
656
657 static apr_status_t ap_headers_fixup(request_rec *r)
658 {
659     headers_conf *dirconf = ap_get_module_config(r->per_dir_config,
660                                                  &headers_module);
661
662     /* do the fixup */
663     if (dirconf->fixup_in->nelts) {
664         do_headers_fixup(r, r->headers_in, dirconf->fixup_in, 0);
665     }
666
667     return DECLINED;
668 }
669 static apr_status_t ap_headers_early(request_rec *r)
670 {
671     headers_conf *dirconf = ap_get_module_config(r->per_dir_config,
672                                                  &headers_module);
673
674     /* do the fixup */
675     if (dirconf->fixup_in->nelts) {
676         do_headers_fixup(r, r->headers_in, dirconf->fixup_in, 1);
677     }
678     if (dirconf->fixup_err->nelts) {
679         do_headers_fixup(r, r->err_headers_out, dirconf->fixup_err, 1);
680     }
681     if (dirconf->fixup_out->nelts) {
682         do_headers_fixup(r, r->headers_out, dirconf->fixup_out, 1);
683     }
684
685     return DECLINED;
686 }
687
688 static const command_rec headers_cmds[] =
689 {
690     AP_INIT_RAW_ARGS("Header", header_cmd, &hdr_out, OR_FILEINFO,
691                      "an optional condition, an action, header and value "
692                      "followed by optional env clause"),
693     AP_INIT_RAW_ARGS("RequestHeader", header_cmd, &hdr_in, OR_FILEINFO,
694                      "an action, header and value followed by optional env "
695                      "clause"),
696     {NULL}
697 };
698
699 static void register_format_tag_handler(const char *tag,
700                                         const void *tag_handler)
701 {
702     apr_hash_set(format_tag_hash, tag, 1, tag_handler);
703 }
704
705 static int header_pre_config(apr_pool_t *p, apr_pool_t *plog, apr_pool_t *ptemp)
706 {
707     format_tag_hash = apr_hash_make(p);
708     register_format_tag_handler("D", (const void *)header_request_duration);
709     register_format_tag_handler("t", (const void *)header_request_time);
710     register_format_tag_handler("e", (const void *)header_request_env_var);
711     register_format_tag_handler("s", (const void *)header_request_ssl_var);
712
713     return OK;
714 }
715
716 static int header_post_config(apr_pool_t *pconf, apr_pool_t *plog,
717                               apr_pool_t *ptemp, server_rec *s)
718 {
719     header_ssl_lookup = APR_RETRIEVE_OPTIONAL_FN(ssl_var_lookup);
720     return OK;
721 }
722
723 static void register_hooks(apr_pool_t *p)
724 {
725     ap_register_output_filter("FIXUP_HEADERS_OUT", ap_headers_output_filter,
726                               NULL, AP_FTYPE_CONTENT_SET);
727     ap_register_output_filter("FIXUP_HEADERS_ERR", ap_headers_error_filter,
728                               NULL, AP_FTYPE_CONTENT_SET);
729     ap_hook_pre_config(header_pre_config,NULL,NULL,APR_HOOK_MIDDLE);
730     ap_hook_post_config(header_post_config,NULL,NULL,APR_HOOK_MIDDLE);
731     ap_hook_insert_filter(ap_headers_insert_output_filter, NULL, NULL, APR_HOOK_LAST);
732     ap_hook_insert_error_filter(ap_headers_insert_error_filter,
733                                 NULL, NULL, APR_HOOK_LAST);
734     ap_hook_fixups(ap_headers_fixup, NULL, NULL, APR_HOOK_LAST);
735     ap_hook_post_read_request(ap_headers_early, NULL, NULL, APR_HOOK_FIRST);
736 }
737
738 module AP_MODULE_DECLARE_DATA headers_module =
739 {
740     STANDARD20_MODULE_STUFF,
741     create_headers_dir_config,  /* dir config creater */
742     merge_headers_config,       /* dir merger --- default is to override */
743     NULL,                       /* server config */
744     NULL,                       /* merge server configs */
745     headers_cmds,               /* command apr_table_t */
746     register_hooks              /* register hooks */
747 };