aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/plugins/surbl.c18
-rwxr-xr-xutils/redirector.pl.in2
2 files changed, 11 insertions, 9 deletions
diff --git a/src/plugins/surbl.c b/src/plugins/surbl.c
index eeb22b543..0711d9cff 100644
--- a/src/plugins/surbl.c
+++ b/src/plugins/surbl.c
@@ -528,18 +528,19 @@ redirector_callback (int fd, short what, void *arg)
struct redirector_param *param = (struct redirector_param *)arg;
char url_buf[1024];
int r;
- struct timeval timeout;
+ struct timeval *timeout;
char *p, *c;
switch (param->state) {
case STATE_CONNECT:
/* We have write readiness after connect call, so reinit event */
if (what == EV_WRITE) {
- timeout.tv_sec = surbl_module_ctx->read_timeout / 1000;
- timeout.tv_usec = surbl_module_ctx->read_timeout - timeout.tv_sec * 1000;
+ timeout = memory_pool_alloc (param->task->task_pool, sizeof (struct timeval));
+ timeout->tv_sec = surbl_module_ctx->read_timeout / 1000;
+ timeout->tv_usec = surbl_module_ctx->read_timeout - timeout->tv_sec * 1000;
event_del (&param->ev);
event_set (&param->ev, param->sock, EV_READ | EV_PERSIST, redirector_callback, (void *)param);
- event_add (&param->ev, &timeout);
+ event_add (&param->ev, timeout);
r = snprintf (url_buf, sizeof (url_buf), "GET %s HTTP/1.0\r\n\r\n", struri (param->url));
if (write (param->sock, url_buf, r) == -1) {
msg_err ("redirector_callback: write failed %s", strerror (errno));
@@ -622,7 +623,7 @@ register_redirector_call (struct uri *url, struct worker_task *task, GTree *url_
{
int s;
struct redirector_param *param;
- struct timeval timeout;
+ struct timeval *timeout;
s = make_tcp_socket (&surbl_module_ctx->redirector_addr, surbl_module_ctx->redirector_port, FALSE);
@@ -640,10 +641,11 @@ register_redirector_call (struct uri *url, struct worker_task *task, GTree *url_
param->state = STATE_CONNECT;
param->sock = s;
param->tree = url_tree;
- timeout.tv_sec = surbl_module_ctx->connect_timeout / 1000;
- timeout.tv_usec = surbl_module_ctx->connect_timeout - timeout.tv_sec * 1000;
+ timeout = memory_pool_alloc (task->task_pool, sizeof (struct timeval));
+ timeout->tv_sec = surbl_module_ctx->connect_timeout / 1000;
+ timeout->tv_usec = surbl_module_ctx->connect_timeout - timeout->tv_sec * 1000;
event_set (&param->ev, s, EV_WRITE, redirector_callback, (void *)param);
- event_add (&param->ev, &timeout);
+ event_add (&param->ev, timeout);
}
static gboolean
diff --git a/utils/redirector.pl.in b/utils/redirector.pl.in
index 04fefb59a..0fc79beea 100755
--- a/utils/redirector.pl.in
+++ b/utils/redirector.pl.in
@@ -381,7 +381,7 @@ sub process_input {
if ((defined($cfg{check_regexp}) && $request->uri !~ $cfg{check_regexp}) ||
(defined($cfg{check_domains}) && scalar(grep {$_ eq $domain} @{$cfg{check_domains}}) == 0)) {
- write_log ($heap->{remote_ip}, "Uri is not checked: " . $request->uri);
+ write_log ($heap->{remote_ip}, "Uri is not checked: " . $request->uri) if $cfg{debug};
my $new_response = HTTP::Response->new(200);
$new_response->header("Uri", $request->uri);
$new_response->header("Connection", "close");