26 * POSSIBILITY OF SUCH DAMAGE. |
26 * POSSIBILITY OF SUCH DAMAGE. |
27 */ |
27 */ |
28 |
28 |
29 #include "vserver.h" |
29 #include "vserver.h" |
30 |
30 |
31 VirtualServer* vs_new() { |
31 #include <cx/hash_map.h> |
32 VirtualServer *vs = malloc(sizeof(VirtualServer)); |
32 |
|
33 VirtualServer* vs_new(pool_handle_t *pool) { |
|
34 VirtualServer *vs = pool_malloc(pool, sizeof(VirtualServer)); |
|
35 ZERO(vs, sizeof(VirtualServer)); |
|
36 vs->pool = pool; |
33 vs->objects = NULL; |
37 vs->objects = NULL; |
34 vs->document_root = cx_mutstr("docs"); |
38 vs->document_root = cx_mutstr("docs"); |
35 vs->acls = NULL; |
39 vs->acls = NULL; |
36 vs->log = NULL; |
40 vs->log = NULL; |
37 vs->ref = 1; |
41 vs->ref = 1; |
38 return vs; |
42 return vs; |
39 } |
43 } |
40 |
44 |
41 |
45 int vs_add_host(VirtualServer *vs, cxstring host) { |
|
46 cxmutstr host_cp = cx_strdup_a(pool_allocator(vs->pool), host); |
|
47 if(!vs->host.ptr) { |
|
48 vs->host = host_cp; |
|
49 } |
|
50 |
|
51 |
|
52 return 0; |
|
53 } |
42 |
54 |
43 |
55 |
44 // public API |
56 // public API |
45 |
57 |
46 char* vs_translate_uri(const VirtualServer *vs, const char *uri) { |
58 char* vs_translate_uri(const VirtualServer *vs, const char *uri) { |