[mod_cgi] skip local-redir handling if to self (fixes #2779, #2108)
[lighttpd.git] / src / data_fastcgi.c
bloba0e4a4b25053b1e544771f50e4d9f5e52214b7f0
1 #include "first.h"
3 #include "array.h"
4 #include "fastcgi.h"
6 #include <string.h>
7 #include <stdio.h>
8 #include <stdlib.h>
10 static data_unset *data_fastcgi_copy(const data_unset *s) {
11 data_fastcgi *src = (data_fastcgi *)s;
12 data_fastcgi *ds = data_fastcgi_init();
14 buffer_copy_buffer(ds->key, src->key);
15 buffer_copy_buffer(ds->host, src->host);
16 ds->is_index_key = src->is_index_key;
17 return (data_unset *)ds;
20 static void data_fastcgi_free(data_unset *d) {
21 data_fastcgi *ds = (data_fastcgi *)d;
23 buffer_free(ds->key);
24 buffer_free(ds->host);
26 free(d);
29 static void data_fastcgi_reset(data_unset *d) {
30 data_fastcgi *ds = (data_fastcgi *)d;
32 buffer_reset(ds->key);
33 buffer_reset(ds->host);
37 static int data_fastcgi_insert_dup(data_unset *dst, data_unset *src) {
38 UNUSED(dst);
40 src->free(src);
42 return 0;
45 static void data_fastcgi_print(const data_unset *d, int depth) {
46 data_fastcgi *ds = (data_fastcgi *)d;
47 UNUSED(depth);
49 fprintf(stdout, "fastcgi(%s)", ds->host->ptr);
53 data_fastcgi *data_fastcgi_init(void) {
54 data_fastcgi *ds;
56 ds = calloc(1, sizeof(*ds));
57 force_assert(NULL != ds);
59 ds->key = buffer_init();
60 ds->host = buffer_init();
61 ds->port = 0;
62 ds->is_disabled = 0;
64 ds->copy = data_fastcgi_copy;
65 ds->free = data_fastcgi_free;
66 ds->reset = data_fastcgi_reset;
67 ds->insert_dup = data_fastcgi_insert_dup;
68 ds->print = data_fastcgi_print;
69 ds->type = TYPE_FASTCGI;
71 return ds;