36 |
36 |
37 httpd_object* object_new(char *name) { |
37 httpd_object* object_new(char *name) { |
38 // TODO: Speicherverwaltung |
38 // TODO: Speicherverwaltung |
39 httpd_object *obj = malloc(sizeof(httpd_object)); |
39 httpd_object *obj = malloc(sizeof(httpd_object)); |
40 obj->name = name; |
40 obj->name = name; |
|
41 obj->path = NULL; |
41 |
42 |
42 // create directive table |
43 // create directive table |
43 obj->dt = calloc(sizeof(struct dtable), NUM_NSAPI_TYPES - 1); |
44 obj->dt = calloc(sizeof(struct dtable), NUM_NSAPI_TYPES - 1); |
44 obj->nd = NUM_NSAPI_TYPES - 1; |
45 obj->nd = NUM_NSAPI_TYPES - 1; |
45 |
46 |
54 |
55 |
55 |
56 |
56 void object_add_directive(httpd_object *obj, directive *dir, int dt) { |
57 void object_add_directive(httpd_object *obj, directive *dir, int dt) { |
57 dtable *l = object_get_dtable(obj, dt); |
58 dtable *l = object_get_dtable(obj, dt); |
58 // allocate space for the new directive |
59 // allocate space for the new directive |
59 l->directive = realloc(l->directive, (l->ndir+1)*sizeof(directive*)); |
60 l->dirs = realloc(l->dirs, (l->ndir+1)*sizeof(directive*)); |
60 // add directive |
61 // add directive |
61 l->directive[l->ndir] = dir; |
62 l->dirs[l->ndir] = dir; |
62 l->ndir++; |
63 l->ndir++; |
63 } |
64 } |
64 |
65 |
65 |
66 |
66 |
67 |