src/server/safs/common.c

changeset 573
76ccfc2a932f
parent 551
97039494764b
child 579
e10457d74fe1
equal deleted inserted replaced
572:e70418bb14b1 573:76ccfc2a932f
72 #define COMMONSAF_RET_NOACTION 1 72 #define COMMONSAF_RET_NOACTION 1
73 #define COMMONSAF_RET_STOP 2 73 #define COMMONSAF_RET_STOP 2
74 #define COMMONSAF_REQ_ABORTED -1 74 #define COMMONSAF_REQ_ABORTED -1
75 #define COMMONSAF_RET_ERROR -2 75 #define COMMONSAF_RET_ERROR -2
76 76
77 static void common_saf_cleanup(void *d) {
78 cxMapDestroy(var_names);
79 }
80
77 void common_saf_init() { 81 void common_saf_init() {
78 var_names = cxHashMapCreate(cxDefaultAllocator, CX_STORE_POINTERS, 32); 82 var_names = cxHashMapCreate(cxDefaultAllocator, CX_STORE_POINTERS, 32);
79 83
80 cxMapPut(var_names, cx_hash_key_str("insert-client"), (void*)(intptr_t)COMMONSAF_INSERT_CLIENT); 84 cxMapPut(var_names, cx_hash_key_str("insert-client"), (void*)(intptr_t)COMMONSAF_INSERT_CLIENT);
81 cxMapPut(var_names, cx_hash_key_str("insert-vars"), (void*)(intptr_t)COMMONSAF_INSERT_VARS); 85 cxMapPut(var_names, cx_hash_key_str("insert-vars"), (void*)(intptr_t)COMMONSAF_INSERT_VARS);
102 cxMapPut(var_names, cx_hash_key_str("find-pathinfo-forward"), (void*)(intptr_t)COMMONSAF_FIND_PATHINFO_FORWARD); 106 cxMapPut(var_names, cx_hash_key_str("find-pathinfo-forward"), (void*)(intptr_t)COMMONSAF_FIND_PATHINFO_FORWARD);
103 cxMapPut(var_names, cx_hash_key_str("http-downgrade"), (void*)(intptr_t)COMMONSAF_HTTP_DOWNGRADE); 107 cxMapPut(var_names, cx_hash_key_str("http-downgrade"), (void*)(intptr_t)COMMONSAF_HTTP_DOWNGRADE);
104 cxMapPut(var_names, cx_hash_key_str("http-upgrade"), (void*)(intptr_t)COMMONSAF_HTTP_UPGRADE); 108 cxMapPut(var_names, cx_hash_key_str("http-upgrade"), (void*)(intptr_t)COMMONSAF_HTTP_UPGRADE);
105 cxMapPut(var_names, cx_hash_key_str("keep-alive"), (void*)(intptr_t)COMMONSAF_KEEP_ALIVE); 109 cxMapPut(var_names, cx_hash_key_str("keep-alive"), (void*)(intptr_t)COMMONSAF_KEEP_ALIVE);
106 cxMapPut(var_names, cx_hash_key_str("name"), (void*)(intptr_t)COMMONSAF_NAME); 110 cxMapPut(var_names, cx_hash_key_str("name"), (void*)(intptr_t)COMMONSAF_NAME);
111
112 webserver_atrestart(common_saf_cleanup, NULL);
107 } 113 }
108 114
109 int print_message(pblock *pb, Session *sn, Request *rq) { 115 int print_message(pblock *pb, Session *sn, Request *rq) {
110 char *msg = pblock_findval("msg", pb); 116 char *msg = pblock_findval("msg", pb);
111 if(msg) { 117 if(msg) {

mercurial