| 94 const CxAllocator *a = cfg->a; |
94 const CxAllocator *a = cfg->a; |
| 95 |
95 |
| 96 WSLocationMatch match = WS_LOCATION_MATCH_EXACT; |
96 WSLocationMatch match = WS_LOCATION_MATCH_EXACT; |
| 97 cxmutstr match_str; |
97 cxmutstr match_str; |
| 98 |
98 |
| 99 int regex_flags = REG_EXTENDED | REG_NOSUB; |
99 int regex_flags = REG_EXTENDED; |
| 100 int argc = serverconfig_directive_count_args(obj); |
100 int argc = serverconfig_directive_count_args(obj); |
| 101 if(argc == 2) { |
101 if(argc == 2) { |
| 102 // arg0: match type |
102 // arg0: match type |
| 103 cxmutstr type_str = obj->args->value; |
103 cxmutstr type_str = obj->args->value; |
| 104 if(!cx_strcmp(type_str, "=")) { |
104 if(!cx_strcmp(type_str, "=")) { |
| 174 // TODO: ... |
174 // TODO: ... |
| 175 |
175 |
| 176 return 0; |
176 return 0; |
| 177 } |
177 } |
| 178 |
178 |
| 179 int location_match(WSLocation *loc, cxstring uri) { |
179 int location_match(WSLocation *loc, cxstring uri, regmatch_t *match) { |
| 180 if(loc->match == WS_LOCATION_MATCH_EXACT) { |
180 if(loc->match == WS_LOCATION_MATCH_EXACT) { |
| 181 return !cx_strcmp(loc->match_string, uri); |
181 return !cx_strcmp(loc->match_string, uri); |
| 182 } else if(loc->match == WS_LOCATION_MATCH_PREFIX) { |
182 } else if(loc->match == WS_LOCATION_MATCH_PREFIX) { |
| 183 return cx_strprefix(uri, loc->match_string); |
183 return cx_strprefix(uri, loc->match_string); |
| 184 } else { |
184 } else { |
| 185 return regexec(&loc->regex, uri.ptr, 0, NULL, 0) == 0; |
185 return regexec(&loc->regex, uri.ptr, 0, match, WS_LOCATION_NMATCH) == 0; |
| 186 } |
186 } |
| 187 return 0; |
187 return 0; |
| 188 } |
188 } |
| 189 |
189 |
| 190 WSLocationConfig* location_match_and_get_config(pool_handle_t *pool, cxstring uri, WSLocation *loc) { |
190 WSLocationConfig* location_match_and_get_config(pool_handle_t *pool, cxstring uri, WSLocation *loc) { |