Changeset 430
- Timestamp:
- 07/08/2005 10:28:46 PM (3 years ago)
- Files:
-
- 1 modified
-
branches/lighttpd-1.3.x/src/mod_trigger_b4_dl.c (modified) (12 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/lighttpd-1.3.x/src/mod_trigger_b4_dl.c
r429 r430 42 42 43 43 array *mc_hosts; 44 buffer *mc_namespace; 44 45 #if defined(HAVE_PCRE_H) 45 46 pcre *trigger_regex; … … 59 60 typedef struct { 60 61 PLUGIN_DATA; 62 63 buffer *tmp_buf; 61 64 62 65 plugin_config **config_storage; … … 70 73 71 74 p = calloc(1, sizeof(*p)); 75 76 p->tmp_buf = buffer_init(); 72 77 73 78 return p; … … 92 97 buffer_free(s->deny_url); 93 98 99 buffer_free(s->mc_namespace); 100 array_free(s->mc_hosts); 101 94 102 #if defined(HAVE_PCRE_H) 95 103 if (s->trigger_regex) pcre_free(s->trigger_regex); … … 111 119 free(p->config_storage); 112 120 } 121 122 buffer_free(p->tmp_buf); 113 123 114 124 free(p); … … 131 141 { "trigger-before-download.trigger-timeout", NULL, T_CONFIG_SHORT, T_CONFIG_SCOPE_CONNECTION }, /* 4 */ 132 142 { "trigger-before-download.memcache-hosts", NULL, T_CONFIG_ARRAY, T_CONFIG_SCOPE_CONNECTION }, /* 5 */ 143 { "trigger-before-download.memcache-namespace", NULL, T_CONFIG_STRING, T_CONFIG_SCOPE_CONNECTION }, /* 6 */ 133 144 { NULL, NULL, T_CONFIG_UNSET, T_CONFIG_SCOPE_UNSET } 134 145 }; … … 159 170 cv[4].destination = &(s->trigger_timeout); 160 171 cv[5].destination = s->mc_hosts; 172 cv[6].destination = s->mc_namespace; 161 173 162 174 p->config_storage[i] = s; … … 268 280 } else if (buffer_is_equal_string(du->key, CONST_STR_LEN("trigger-before-download.deny-url"))) { 269 281 PATCH(deny_url); 282 } else if (buffer_is_equal_string(du->key, CONST_STR_LEN("trigger-before-download.memcache-namespace"))) { 283 PATCH(mc_namespace); 270 284 } else if (buffer_is_equal_string(du->key, CONST_STR_LEN("trigger-before-download.memcache-hosts"))) { 271 285 #if defined(HAVE_MEMCACHE_H) … … 356 370 } else if (p->conf.mc) { 357 371 # if defined(HAVE_MEMCACHE_H) 372 buffer_copy_string_buffer(p->tmp_buf, p->conf.mc_namespace); 373 buffer_append_string(p->tmp_buf, remote_ip); 374 358 375 if (0 != mc_set(p->conf.mc, 359 (char *)remote_ip, strlen(remote_ip),376 CONST_BUF_LEN(p->tmp_buf), 360 377 (char *)&(srv->cur_ts), sizeof(srv->cur_ts), 361 378 p->conf.trigger_timeout, 0)) { … … 436 453 void *r; 437 454 455 buffer_copy_string_buffer(p->tmp_buf, p->conf.mc_namespace); 456 buffer_append_string(p->tmp_buf, remote_ip); 457 438 458 /** 439 459 * … … 443 463 */ 444 464 if (NULL == (r = mc_aget(p->conf.mc, 445 (char *)remote_ip, strlen(remote_ip)))) { 465 CONST_BUF_LEN(p->tmp_buf) 466 ))) { 446 467 447 468 response_header_insert(srv, con, CONST_STR_LEN("Location"), CONST_BUF_LEN(p->conf.deny_url)); … … 456 477 /* set a new timeout */ 457 478 if (0 != mc_set(p->conf.mc, 458 (char *)remote_ip, strlen(remote_ip),479 CONST_BUF_LEN(p->tmp_buf), 459 480 (char *)&(srv->cur_ts), sizeof(srv->cur_ts), 460 481 p->conf.trigger_timeout, 0)) {

