diff options
author | Robert James Kaes <rjkaes@users.sourceforge.net> | 2002-05-27 02:00:22 +0000 |
---|---|---|
committer | Robert James Kaes <rjkaes@users.sourceforge.net> | 2002-05-27 02:00:22 +0000 |
commit | 4ce96743656291e92e92f0ef41318dc2a48751d2 (patch) | |
tree | 3c43e78a2014fd19c597ecfeafd17c15a4043f29 /src | |
parent | 35d3d79e9236e53a4210056219f755c91c8cf7d6 (diff) | |
download | tinyproxy-4ce96743656291e92e92f0ef41318dc2a48751d2.tar.gz tinyproxy-4ce96743656291e92e92f0ef41318dc2a48751d2.zip |
(process_request): Changed the filtering code around to handle both domains and URLs.
Diffstat (limited to '')
-rw-r--r-- | src/reqs.c | 31 |
1 files changed, 21 insertions, 10 deletions
@@ -1,4 +1,4 @@ -/* $Id: reqs.c,v 1.76 2002-05-26 18:54:56 rjkaes Exp $ +/* $Id: reqs.c,v 1.77 2002-05-27 02:00:22 rjkaes Exp $ * * This is where all the work in tinyproxy is actually done. Incoming * connections have a new child created for them. The child then @@ -408,22 +408,31 @@ process_request(struct conn_s *connptr) return NULL; } - safefree(url); - #ifdef FILTER_ENABLE /* - * Filter restricted domains + * Filter restricted domains/urls */ if (config.filter) { - if (filter_url(request->host)) { + if (config.filter_url) + ret = filter_url(url); + else + ret = filter_domain(request->host); + + if (ret) { update_stats(STAT_DENIED); - log_message(LOG_NOTICE, - "Proxying refused on filtered domain \"%s\"", - request->host); - indicate_http_error(connptr, 404, - "Connection to filtered domain is not allowed."); + if (config.filter_url) + log_message(LOG_NOTICE, + "Proxying refused on filtered url \"%s\"", + url); + else + log_message(LOG_NOTICE, + "Proxying refused on filtered domain \"%s\"", + request->host); + indicate_http_error(connptr, 403, "Filtered."); + + safefree(url); free_request_struct(request); return NULL; @@ -431,6 +440,8 @@ process_request(struct conn_s *connptr) } #endif + safefree(url); + /* * Check to see if they're requesting the stat host */ |