Browse Source

replace spaces by _ for memcache

git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.3.x@443 152afb58-edef-0310-8abb-c4023f1b3aa9
svn/tags/lighttpd-1.3.15
Jan Kneschke 17 years ago
parent
commit
d8cf40597a
  1. 17
      src/mod_trigger_b4_dl.c

17
src/mod_trigger_b4_dl.c

@ -350,6 +350,8 @@ URIHANDLER_FUNC(mod_trigger_b4_dl_uri_handler) {
/* X-Forwarded-For contains the ip behind the proxy */
remote_ip = ds->value->ptr;
/* memcache can't handle spaces */
} else {
remote_ip = inet_ntop_cache_get_ip(srv, &(con->dst_addr));
}
@ -385,6 +387,10 @@ URIHANDLER_FUNC(mod_trigger_b4_dl_uri_handler) {
buffer_copy_string_buffer(p->tmp_buf, p->conf.mc_namespace);
buffer_append_string(p->tmp_buf, remote_ip);
for (i = 0; i < p->tmp_buf->used - 1; i++) {
if (p->tmp_buf->ptr[i] == ' ') p->tmp_buf->ptr[i] = '-';
}
if (0 != mc_set(p->conf.mc,
CONST_BUF_LEN(p->tmp_buf),
(char *)&(srv->cur_ts), sizeof(srv->cur_ts),
@ -440,13 +446,6 @@ URIHANDLER_FUNC(mod_trigger_b4_dl_uri_handler) {
log_error_write(srv, __FILE__, __LINE__, "s",
"delete failed");
}
} else if (p->conf.mc) {
if (0 != mc_delete(p->conf.mc,
(char *)remote_ip, strlen(remote_ip),
0)) {
log_error_write(srv, __FILE__, __LINE__, "s",
"insert failed");
}
}
return HANDLER_FINISHED;
@ -469,6 +468,10 @@ URIHANDLER_FUNC(mod_trigger_b4_dl_uri_handler) {
buffer_copy_string_buffer(p->tmp_buf, p->conf.mc_namespace);
buffer_append_string(p->tmp_buf, remote_ip);
for (i = 0; i < p->tmp_buf->used - 1; i++) {
if (p->tmp_buf->ptr[i] == ' ') p->tmp_buf->ptr[i] = '-';
}
/**
*
* memcached is do expiration for us, as long as we can fetch it every thing is ok

Loading…
Cancel
Save