Changeset 39 in Main
- Timestamp:
- Sep 17, 2024, 9:20:48 PM (2 months ago)
- Location:
- trunk
- Files:
-
- 1 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Module/Makefile
r18 r39 6 6 .SUFFIXES: .c .o .so 7 7 8 all: mod_example.so 8 all: mod_example.so mod_cgi.so 9 9 10 10 .o.so: -
trunk/Server/config.c
r33 r39 296 296 } 297 297 } else { 298 stop = 1; 298 299 if(r[0] != NULL) { 299 cm_log("Config", "Unknown directive `%s' at line %d", r[0], ln); 300 } 301 stop = 1; 300 int argc; 301 for(argc = 0; r[argc] != NULL; argc++) 302 ; 303 stop = 0; 304 int i; 305 bool called = false; 306 struct tw_tool tools; 307 tw_init_tools(&tools); 308 for(i = 0; i < config.module_count; i++) { 309 tw_mod_config_t mod_config = (tw_mod_config_t)tw_module_symbol(config.modules[i], "mod_config"); 310 int resp; 311 if(mod_config != NULL && (resp = mod_config(&tools, r, argc)) == TW_CONFIG_PARSED) { 312 called = true; 313 break; 314 } 315 if(resp == TW_CONFIG_ERROR) { 316 stop = 1; 317 called = true; 318 break; 319 } 320 } 321 if(!called) { 322 cm_log("Config", "Unknown directive `%s' at line %d", r[0], ln); 323 stop = 1; 324 } 325 } 302 326 } 303 327 for(i = 0; r[i] != NULL; i++) free(r[i]); -
trunk/Server/tw_module.h
r20 r39 15 15 _TW_MODULE_PASS = 0, /* Pass to the next module. */ 16 16 _TW_MODULE_STOP, /* Do not pass to the next module. */ 17 _TW_MODULE_ERROR /* Error, and do not pass to the next module. */ 17 _TW_MODULE_ERROR, /* Error, and do not pass to the next module. */ 18 19 _TW_CONFIG_PARSED, /* Got parsed */ 20 _TW_CONFIG_NOTME, /* Did not parse */ 21 _TW_CONFIG_ERROR /* Error */ 18 22 }; 19 23 … … 22 26 #define TW_MODULE_ERROR(x) (_TW_MODULE_ERROR | ((x) << 8)) 23 27 28 #define TW_CONFIG_PARSED _TW_CONFIG_PARSED 29 #define TW_CONFIG_NOTME _TW_CONFIG_NOTME 30 #define TW_CONFIG_ERROR _TW_CONFIG_ERROR 31 24 32 typedef int (*tw_mod_init_t)(struct tw_config* config, struct tw_tool* tools); 25 33 typedef int (*tw_mod_request_t)(struct tw_tool* tools, struct tw_http_request* req, struct tw_http_response* res); 34 typedef int (*tw_mod_config_t)(struct tw_tool* tools, char** argv, int argc); 26 35 27 36 void* tw_module_load(const char* path); -
trunk/example.conf
r33 r39 2 2 # This is an example config 3 3 4 #LoadModule /home/nishi/SVN/tewi/trunk/Module/mod_example.so4 LoadModule /home/nishi/SVN/tewi/trunk/Module/mod_cgi.so 5 5 6 6 Listen 80
Note:
See TracChangeset
for help on using the changeset viewer.