226 // check event handler config |
226 // check event handler config |
227 if(check_event_handler_cfg() != 0) { |
227 if(check_event_handler_cfg() != 0) { |
228 /* critical error */ |
228 /* critical error */ |
229 return NULL; |
229 return NULL; |
230 } |
230 } |
231 cxListDestroy(list); |
231 cxListFree(list); |
232 |
232 |
233 // load Listener config |
233 // load Listener config |
234 log_ereport(LOG_DEBUG, "apply config: Listener"); |
234 log_ereport(LOG_DEBUG, "apply config: Listener"); |
235 list = serverconfig_get_node_list(serverconf->root, CONFIG_NODE_OBJECT, cx_str("Listener")); |
235 list = serverconfig_get_node_list(serverconf->root, CONFIG_NODE_OBJECT, cx_str("Listener")); |
236 iter = cxListIterator(list); |
236 iter = cxListIterator(list); |
237 cx_foreach(ConfigNode *, scfgobj, iter) { |
237 cx_foreach(ConfigNode *, scfgobj, iter) { |
238 if(cfg_handle_listener(serverconfig, scfgobj)) { |
238 if(cfg_handle_listener(serverconfig, scfgobj)) { |
239 return NULL; |
239 return NULL; |
240 } |
240 } |
241 } |
241 } |
242 cxListDestroy(list); |
242 cxListFree(list); |
243 |
243 |
244 // we return here, to let the webserver use the runtime info to |
244 // we return here, to let the webserver use the runtime info to |
245 // change the uid if needed |
245 // change the uid if needed |
246 return serverconfig; |
246 return serverconfig; |
247 } |
247 } |
269 list = serverconfig_get_node_list(serverconf->root, CONFIG_NODE_OBJECT, cx_str("LogFile")); |
269 list = serverconfig_get_node_list(serverconf->root, CONFIG_NODE_OBJECT, cx_str("LogFile")); |
270 CxIterator iter = cxListIterator(list); |
270 CxIterator iter = cxListIterator(list); |
271 cx_foreach(ConfigNode *, logobj, iter) { |
271 cx_foreach(ConfigNode *, logobj, iter) { |
272 if(!logobj) { |
272 if(!logobj) { |
273 // error |
273 // error |
274 cxListDestroy(list); |
274 cxListFree(list); |
275 return NULL; |
275 return NULL; |
276 } |
276 } |
277 |
277 |
278 int ret = cfg_handle_logfile(serverconfig, logobj); |
278 int ret = cfg_handle_logfile(serverconfig, logobj); |
279 if(ret != 0) { |
279 if(ret != 0) { |
280 // cannot initialize log file |
280 // cannot initialize log file |
281 cxListDestroy(list); |
281 cxListFree(list); |
282 return NULL; |
282 return NULL; |
283 } |
283 } |
284 } |
284 } |
285 cxListDestroy(list); |
285 cxListFree(list); |
286 |
286 |
287 log_ereport(LOG_DEBUG, "apply config: AccessLog"); |
287 log_ereport(LOG_DEBUG, "apply config: AccessLog"); |
288 list = serverconfig_get_node_list(serverconf->root, CONFIG_NODE_OBJECT, cx_str("AccessLog")); |
288 list = serverconfig_get_node_list(serverconf->root, CONFIG_NODE_OBJECT, cx_str("AccessLog")); |
289 iter = cxListIterator(list); |
289 iter = cxListIterator(list); |
290 cx_foreach(ConfigNode *, scfgobj, iter) { |
290 cx_foreach(ConfigNode *, scfgobj, iter) { |
291 if(cfg_handle_accesslog(serverconfig, scfgobj)) { |
291 if(cfg_handle_accesslog(serverconfig, scfgobj)) { |
292 return NULL; |
292 return NULL; |
293 } |
293 } |
294 } |
294 } |
295 cxListDestroy(list); |
295 cxListFree(list); |
296 |
296 |
297 log_ereport(LOG_DEBUG, "apply config: AuthDB"); |
297 log_ereport(LOG_DEBUG, "apply config: AuthDB"); |
298 list = serverconfig_get_node_list(serverconf->root, CONFIG_NODE_OBJECT, cx_str("AuthDB")); |
298 list = serverconfig_get_node_list(serverconf->root, CONFIG_NODE_OBJECT, cx_str("AuthDB")); |
299 iter = cxListIterator(list); |
299 iter = cxListIterator(list); |
300 cx_foreach(ConfigNode *, scfgobj, iter) { |
300 cx_foreach(ConfigNode *, scfgobj, iter) { |
301 if(cfg_handle_authdb(serverconfig, scfgobj)) { |
301 if(cfg_handle_authdb(serverconfig, scfgobj)) { |
302 return NULL; |
302 return NULL; |
303 } |
303 } |
304 } |
304 } |
305 cxListDestroy(list); |
305 cxListFree(list); |
306 |
306 |
307 log_ereport(LOG_DEBUG, "apply config: VirtualServer"); |
307 log_ereport(LOG_DEBUG, "apply config: VirtualServer"); |
308 list = serverconfig_get_node_list(serverconf->root, CONFIG_NODE_OBJECT, cx_str("VirtualServer")); |
308 list = serverconfig_get_node_list(serverconf->root, CONFIG_NODE_OBJECT, cx_str("VirtualServer")); |
309 iter = cxListIterator(list); |
309 iter = cxListIterator(list); |
310 cx_foreach(ConfigNode *, scfgobj, iter) { |
310 cx_foreach(ConfigNode *, scfgobj, iter) { |
311 if(cfg_handle_vs(serverconfig, scfgobj)) { |
311 if(cfg_handle_vs(serverconfig, scfgobj)) { |
312 return NULL; |
312 return NULL; |
313 } |
313 } |
314 } |
314 } |
315 cxListDestroy(list); |
315 cxListFree(list); |
316 |
316 |
317 log_ereport(LOG_DEBUG, "apply config: ResourcePool"); |
317 log_ereport(LOG_DEBUG, "apply config: ResourcePool"); |
318 list = serverconfig_get_node_list(serverconf->root, CONFIG_NODE_OBJECT, cx_str("ResourcePool")); |
318 list = serverconfig_get_node_list(serverconf->root, CONFIG_NODE_OBJECT, cx_str("ResourcePool")); |
319 iter = cxListIterator(list); |
319 iter = cxListIterator(list); |
320 cx_foreach(ConfigNode *, scfgobj, iter) { |
320 cx_foreach(ConfigNode *, scfgobj, iter) { |
321 if(cfg_handle_resourcepool(serverconfig, scfgobj)) { |
321 if(cfg_handle_resourcepool(serverconfig, scfgobj)) { |
322 return NULL; |
322 return NULL; |
323 } |
323 } |
324 } |
324 } |
325 cxListDestroy(list); |
325 cxListFree(list); |
326 |
326 |
327 log_ereport(LOG_DEBUG, "apply config: Dav"); |
327 log_ereport(LOG_DEBUG, "apply config: Dav"); |
328 list = serverconfig_get_node_list(serverconf->root, CONFIG_NODE_OBJECT, cx_str("Dav")); |
328 list = serverconfig_get_node_list(serverconf->root, CONFIG_NODE_OBJECT, cx_str("Dav")); |
329 iter = cxListIterator(list); |
329 iter = cxListIterator(list); |
330 cx_foreach(ConfigNode *, scfgobj, iter) { |
330 cx_foreach(ConfigNode *, scfgobj, iter) { |
331 if(cfg_handle_dav(serverconfig, scfgobj)) { |
331 if(cfg_handle_dav(serverconfig, scfgobj)) { |
332 return NULL; |
332 return NULL; |
333 } |
333 } |
334 } |
334 } |
335 cxListDestroy(list); |
335 cxListFree(list); |
336 |
336 |
337 // set VirtualServer for all listeners |
337 // set VirtualServer for all listeners |
338 CxList *ls = serverconfig->listeners; |
338 CxList *ls = serverconfig->listeners; |
339 iter = cxListIterator(ls); |
339 iter = cxListIterator(ls); |
340 cx_foreach(HttpListener *, listener, iter) { |
340 cx_foreach(HttpListener *, listener, iter) { |
341 cxstring vsname = cx_str(listener->default_vs.vs_name); |
341 cxstring vsname = cx_str(listener->default_vs.vs_name); |
342 |
342 |
343 // search for VirtualServer |
343 // search for VirtualServer |
344 //int b = 0; |
344 //int b = 0; |
345 CxIterator map_iter = cxMapIteratorValues(serverconfig->host_vs); |
345 CxMapIterator map_iter = cxMapIteratorValues(serverconfig->host_vs); |
346 cx_foreach(VirtualServer *, vs, map_iter) { |
346 cx_foreach(VirtualServer *, vs, map_iter) { |
347 if(!cx_strcmp(vsname, (cxstring){vs->name.ptr, vs->name.length})) { |
347 if(!cx_strcmp(vsname, (cxstring){vs->name.ptr, vs->name.length})) { |
348 listener->default_vs.vs = vs; |
348 listener->default_vs.vs = vs; |
349 break; |
349 break; |
350 } |
350 } |