File: header.c

package info (click to toggle)
libapache-mod-layout 3.0.3-2
  • links: PTS
  • area: main
  • in suites: woody
  • size: 328 kB
  • ctags: 218
  • sloc: ansic: 1,331; makefile: 114; sh: 93
file content (43 lines) | stat: -rw-r--r-- 1,198 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
/* 
**  header.c -- Apache layout module
**  $Revision: 1.5 $
*/

#include "mod_layout.h"

LAYOUT_EXPORT(void)layout_header(request_rec *r, layout_conf *cfg, layout_request *info) {
	int x = 0;
	int assbackwards = 0;
	int status = OK;
	layout_string **current_header;

  current_header = (layout_string **) cfg->header->elts;

	for(x = 0; x < cfg->header->nelts; x++) {
		if(isOn(cfg->comment)){
			unless((x == 0 && (info->http == HEADER)))
				ap_rprintf(r, "\n\n<!-- Beginning of: %s -->\n\n", current_header[x]->comment);
		}

#ifdef DEBUG
		printf("Calling Header %s\n", current_header[x]->comment);
#endif

		/* Now lets see about headers */
		if (current_header[x]->type > 0) {
			ap_rputs(current_header[x]->string, r);
		} else {
			if(x == 0 && (info->http == HEADER)) {
				assbackwards = 0;
			} else {
				assbackwards = 1;
			}

			if ((status = call_container(r, current_header[x]->string, cfg, info, assbackwards)) != OK){
				ap_log_rerror(APLOG_MARK, APLOG_NOERRNO | APLOG_ERR, r, "The following error occured while processing the LayoutHeader : %d", status); 
			}
		}
		if (isOn(cfg->comment)) 
			ap_rprintf(r, "\n\n<!-- End of: %s -->\n\n", current_header[x]->comment );
	}
}