2016-03-19 15:14:35 +00:00
|
|
|
#include "first.h"
|
|
|
|
|
2009-10-11 14:31:42 +00:00
|
|
|
#include "array.h"
|
|
|
|
#include "fastcgi.h"
|
|
|
|
|
2005-02-20 14:27:00 +00:00
|
|
|
#include <string.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
|
2005-08-08 16:36:51 +00:00
|
|
|
static data_unset *data_fastcgi_copy(const data_unset *s) {
|
2005-08-08 14:40:47 +00:00
|
|
|
data_fastcgi *src = (data_fastcgi *)s;
|
|
|
|
data_fastcgi *ds = data_fastcgi_init();
|
|
|
|
|
2015-02-08 12:37:10 +00:00
|
|
|
buffer_copy_buffer(ds->key, src->key);
|
|
|
|
buffer_copy_buffer(ds->host, src->host);
|
2005-08-23 14:35:01 +00:00
|
|
|
ds->is_index_key = src->is_index_key;
|
2005-08-08 14:40:47 +00:00
|
|
|
return (data_unset *)ds;
|
|
|
|
}
|
|
|
|
|
2005-02-20 14:27:00 +00:00
|
|
|
static void data_fastcgi_free(data_unset *d) {
|
|
|
|
data_fastcgi *ds = (data_fastcgi *)d;
|
2006-10-04 13:26:23 +00:00
|
|
|
|
2005-02-20 14:27:00 +00:00
|
|
|
buffer_free(ds->key);
|
|
|
|
buffer_free(ds->host);
|
2006-10-04 13:26:23 +00:00
|
|
|
|
2005-02-20 14:27:00 +00:00
|
|
|
free(d);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void data_fastcgi_reset(data_unset *d) {
|
|
|
|
data_fastcgi *ds = (data_fastcgi *)d;
|
2006-10-04 13:26:23 +00:00
|
|
|
|
2005-02-20 14:27:00 +00:00
|
|
|
buffer_reset(ds->key);
|
|
|
|
buffer_reset(ds->host);
|
2006-10-04 13:26:23 +00:00
|
|
|
|
2005-02-20 14:27:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static int data_fastcgi_insert_dup(data_unset *dst, data_unset *src) {
|
|
|
|
UNUSED(dst);
|
|
|
|
|
|
|
|
src->free(src);
|
2006-10-04 13:26:23 +00:00
|
|
|
|
2005-02-20 14:27:00 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2005-08-08 16:36:51 +00:00
|
|
|
static void data_fastcgi_print(const data_unset *d, int depth) {
|
2005-02-20 14:27:00 +00:00
|
|
|
data_fastcgi *ds = (data_fastcgi *)d;
|
2005-08-08 17:25:06 +00:00
|
|
|
UNUSED(depth);
|
2006-10-04 13:26:23 +00:00
|
|
|
|
2006-09-20 14:37:15 +00:00
|
|
|
fprintf(stdout, "fastcgi(%s)", ds->host->ptr);
|
2005-02-20 14:27:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
data_fastcgi *data_fastcgi_init(void) {
|
|
|
|
data_fastcgi *ds;
|
2006-10-04 13:26:23 +00:00
|
|
|
|
2005-02-20 14:27:00 +00:00
|
|
|
ds = calloc(1, sizeof(*ds));
|
2016-01-30 13:59:07 +00:00
|
|
|
force_assert(NULL != ds);
|
2006-10-04 13:26:23 +00:00
|
|
|
|
2005-02-20 14:27:00 +00:00
|
|
|
ds->key = buffer_init();
|
|
|
|
ds->host = buffer_init();
|
|
|
|
ds->port = 0;
|
2005-05-08 06:25:17 +00:00
|
|
|
ds->is_disabled = 0;
|
2006-10-04 13:26:23 +00:00
|
|
|
|
2005-08-08 14:40:47 +00:00
|
|
|
ds->copy = data_fastcgi_copy;
|
2005-02-20 14:27:00 +00:00
|
|
|
ds->free = data_fastcgi_free;
|
|
|
|
ds->reset = data_fastcgi_reset;
|
|
|
|
ds->insert_dup = data_fastcgi_insert_dup;
|
|
|
|
ds->print = data_fastcgi_print;
|
|
|
|
ds->type = TYPE_FASTCGI;
|
2006-10-04 13:26:23 +00:00
|
|
|
|
2005-02-20 14:27:00 +00:00
|
|
|
return ds;
|
|
|
|
}
|