| 31 #include "request.h" |
31 #include "request.h" |
| 32 #include "../util/util.h" |
32 #include "../util/util.h" |
| 33 #include "../util/pblock.h" |
33 #include "../util/pblock.h" |
| 34 #include "vserver.h" |
34 #include "vserver.h" |
| 35 #include <cx/linked_list.h> |
35 #include <cx/linked_list.h> |
| |
36 #include <cx/array_list.h> |
| 36 |
37 |
| 37 #define DIR_CHECK_ARGC(n) if(argc != n) { \ |
38 #define DIR_CHECK_ARGC(n) if(argc != n) { \ |
| 38 log_ereport(LOG_FAILURE, "%s directive argc != %d", name.ptr, n); \ |
39 log_ereport(LOG_FAILURE, "%s directive argc != %d", name.ptr, n); \ |
| 39 return 1; \ |
40 return 1; \ |
| 40 } |
41 } |
| 55 location->config.set_dirindex = TRUE; |
56 location->config.set_dirindex = TRUE; |
| 56 location->config.dirindex = util_getboolean_s(cx_strcast(dir->args->value), FALSE); |
57 location->config.dirindex = util_getboolean_s(cx_strcast(dir->args->value), FALSE); |
| 57 } else if(!cx_strcasecmp(name, "DocumentRoot")) { |
58 } else if(!cx_strcasecmp(name, "DocumentRoot")) { |
| 58 DIR_CHECK_ARGC(1); |
59 DIR_CHECK_ARGC(1); |
| 59 location->config.docroot = cx_strdup_a(a, dir->args->value); |
60 location->config.docroot = cx_strdup_a(a, dir->args->value); |
| |
61 } else if(!cx_strcasecmp(name, "AddACL")) { |
| |
62 DIR_CHECK_ARGC(1); |
| |
63 if(!location->config.acls) { |
| |
64 CxList *aclList = cxLinkedListCreate(cfg->a, NULL, CX_STORE_POINTERS); |
| |
65 if(!aclList) { |
| |
66 return 1; |
| |
67 } |
| |
68 location->config.acls = aclList; |
| |
69 cxmutstr aclName = dir->args->value; |
| |
70 if(cxListAdd(aclList, aclName.ptr)) { |
| |
71 return 1; |
| |
72 } |
| |
73 } |
| 60 } else if(!cx_strcasecmp(name, "Location")) { |
74 } else if(!cx_strcasecmp(name, "Location")) { |
| 61 WSLocation *sub_location = cfg_location_get(cfg, dir); |
75 WSLocation *sub_location = cfg_location_get(cfg, dir); |
| 62 if(!sub_location) { |
76 if(!sub_location) { |
| 63 return 1; |
77 return 1; |
| 64 } |
78 } |