X-Git-Url: http://www.privoxy.org/gitweb/contact.html?a=blobdiff_plain;f=client-tags.c;h=d8cbb350fab7584caed84f05d1e81276a3470019;hb=af381609cc6f322ab864bc2372fec8769f3eb599;hp=c5aa9552c825ee95f11b80cd16ab69f7a3e46db1;hpb=3b0f6d2f765d3a48684b563f9830d4af5330d5a0;p=privoxy.git diff --git a/client-tags.c b/client-tags.c index c5aa9552..d8cbb350 100644 --- a/client-tags.c +++ b/client-tags.c @@ -43,6 +43,7 @@ #include "miscutil.h" #include "errlog.h" #include "parsers.h" +#include "urlmatch.h" struct client_specific_tag { @@ -233,7 +234,7 @@ void get_tag_list_for_client(struct list *tag_list, if (enabled_tags->end_of_life && (enabled_tags->end_of_life < now)) { struct client_specific_tag *next_tag = enabled_tags->next; - log_error(LOG_LEVEL_INFO, + log_error(LOG_LEVEL_TAGGING, "Tag '%s' for client %s expired %ld seconds ago. Deleting it.", enabled_tags->name, client_address, (now - enabled_tags->end_of_life)); @@ -243,6 +244,8 @@ void get_tag_list_for_client(struct list *tag_list, } else { + log_error(LOG_LEVEL_TAGGING, "Enlisting tag '%s' for client %s.", + enabled_tags->name, client_address); enlist(tag_list, enabled_tags->name); } enabled_tags = enabled_tags->next; @@ -276,14 +279,15 @@ time_t get_next_tag_timeout_for_client(const char *client_address) enabled_tags = get_tags_for_client(client_address); while (enabled_tags != NULL) { - log_error(LOG_LEVEL_CGI, "Evaluating tag '%s' for client %s. End of life %d", + log_error(LOG_LEVEL_TAGGING, + "Evaluating tag '%s' for client %s. End of life %ld.", enabled_tags->name, client_address, enabled_tags->end_of_life); if (enabled_tags->end_of_life) { time_t time_left = enabled_tags->end_of_life - now; /* Add a second to make sure the tag will have expired */ time_left++; - log_error(LOG_LEVEL_CGI, "%d > %d?", next_timeout, time_left); + log_error(LOG_LEVEL_CGI, "%ld > %ld?", next_timeout, time_left); if (next_timeout == 0 || next_timeout > time_left) { next_timeout = time_left; @@ -294,7 +298,7 @@ time_t get_next_tag_timeout_for_client(const char *client_address) privoxy_mutex_unlock(&client_tags_mutex); - log_error(LOG_LEVEL_CGI, "Next timeout in %d seconds", next_timeout); + log_error(LOG_LEVEL_CGI, "Next timeout in %ld seconds", next_timeout); return next_timeout; @@ -561,14 +565,15 @@ jb_err enable_client_specific_tag(struct client_state *csp, if (client_has_requested_tag(csp->client_address, tag_name)) { - log_error(LOG_LEVEL_ERROR, - "Tag '%s' already enabled for client '%s'", tag->name, csp->client_address); + log_error(LOG_LEVEL_TAGGING, + "Tag '%s' already enabled for client '%s'.", + tag->name, csp->client_address); } else { add_tag_for_client(csp->client_address, tag_name, time_to_live); - log_error(LOG_LEVEL_INFO, - "Tag '%s' enabled for client '%s'. TTL: %d.", + log_error(LOG_LEVEL_TAGGING, + "Tag '%s' enabled for client '%s'. TTL: %ld.", tag->name, csp->client_address, time_to_live); } @@ -607,13 +612,13 @@ jb_err disable_client_specific_tag(struct client_state *csp, const char *tag_nam if (client_has_requested_tag(csp->client_address, tag_name)) { remove_tag_for_client(csp->client_address, tag_name); - log_error(LOG_LEVEL_INFO, - "Tag '%s' disabled for client '%s'", tag->name, csp->client_address); + log_error(LOG_LEVEL_TAGGING, + "Tag '%s' disabled for client '%s'.", tag->name, csp->client_address); } else { - log_error(LOG_LEVEL_ERROR, - "Tag '%s' currently not set for client '%s'", + log_error(LOG_LEVEL_TAGGING, + "Tag '%s' currently not set for client '%s'.", tag->name, csp->client_address); } @@ -654,8 +659,9 @@ int client_tag_match(const struct pattern_spec *pattern, for (tag = tags->first; tag != NULL; tag = tag->next) { - if (0 == regexec(pattern->pattern.tag_regex, tag->str, 0, NULL, 0)) + if (regex_matches(pattern->pattern.tag_regex, tag->str)) { + log_error(LOG_LEVEL_TAGGING, "Client tag '%s' matches.", tag->str); return 1; } }