Commit Graph

16 Commits (master)

Author SHA1 Message Date
rofl0r 58cfaf2659 make acl lookup 450x faster by using sblist
tested with 32K acl rules, generated by

    for x in `seq 128` ; do for y in `seq 255` ; do \
    echo "Deny 10.$x.$y.0/24" ; done ; done

after loading the config (which is dogslow too), tinyproxy
required 9.5 seconds for the acl check on every request.
after switching the list implementation to sblist, a request
with the full acl check now takes only 0.025 seconds.
the time spent for loading the config file is identical for both
list implementations, roughly 30 seconds.

(in a previous test, 65K acl rules were generated, but every
connection required almost 2 minutes to crunch through the list...)
2020-09-07 22:09:35 +01:00
rofl0r ebc7f15ec7 acl: typedef access_list to acl_list_t
this allows to switch the underlying implementation easily.
2020-09-07 21:53:14 +01:00
rofl0r f6d4da5d81 do hostname resolution only when it is absolutely necessary for ACL check
tinyproxy used to do a full hostname resolution whenever a new client
connection happened, which could cause very long delays (as reported in #198).

there's only a single place/scenario that actually requires a hostname, and
that is when an Allow/Deny rule exists for a hostname or domain, rather than
a raw IP address. since it is very likely this feature is not very widely used,
it makes absolute sense to only do the costly resolution when it is unavoidable.
2019-12-21 00:43:45 +00:00
Michael Adam 7290691142 Move definition of "struct config_s" from main.h to conf.h
Michael
2009-12-07 22:33:27 +01:00
Michael Adam 8cb182e1b8 Add access_list to the config struct instead of a global variable in acl.c.
Change insert_acl, check_acl and flush_access_list to take a corresponding
argument.

Michael
2009-12-07 00:22:46 +01:00
Michael Adam 6266197e92 acl: add function flush_access_list(). 2009-12-07 00:22:46 +01:00
Mukund Sivaraman 7b9234f394 Indent code to Tinyproxy coding style
The modified files were indented with GNU indent using the
following command:

indent -npro -kr -i8 -ts8 -sob -l80 -ss -cs -cp1 -bs -nlps -nprs -pcs \
    -saf -sai -saw -sc -cdw -ce -nut -il0

No other changes of any sort were made.
2009-09-15 01:11:25 +05:30
Michael Adam 14a3e187ee check_acl(): remove the fd argument - it is not used.
Host name and IP address are provided instead.

Michael
2009-08-04 23:47:27 +02:00
Mukund Sivaraman 024b317de0 Convert tabs to spaces 2008-12-08 13:39:44 +00:00
Mukund Sivaraman a257703e59 Reformat code to GNU coding style
This is a commit which simply ran all C source code files
through GNU indent. No other modifications were made.
2008-12-01 15:01:11 +00:00
Mukund Sivaraman 249d4b7f33 Updated copyright, license notices in source code
The notices have been changed to a more GNU look. Documentation
comments have been separated from the copyright header. I've tried to
keep all copyright notices intact. Some author contact details have
been updated.
2008-05-24 13:35:49 +05:30
Robert James Kaes c0299e1868 * [Indent] Ran Source Through indent
I re-indented the source code using indent with the following options:

indent -kr -bad -bap -nut -i8 -l80 -psl -sob -ss -ncs

There are now _no_ tabs in the source files, and all indentation is
eight spaces.  Lines are 80 characters long, and the procedure type is
on it's own line.  Read the indent manual for more information about
what each option means.
2005-08-15 03:54:31 +00:00
Robert James Kaes a59117c7ca * Updated Copyright Email Addresses
Updated the copyright email addresses for Robert James Kaes.  The
users.sourceforge.net address should always exist.
2005-07-12 17:39:44 +00:00
Robert James Kaes 44bbdb2623 Changed the check_acl() function to require the peer IP address and string
address from the calling function.
2002-04-17 20:52:45 +00:00
Robert James Kaes 0a5b82cd97 Fixed up the names of the DEFINES. 2001-06-02 02:07:34 +00:00
Robert James Kaes de6f42d9fa Improvied access control semantics. Allows for a finger control for
allowing and denying hosts.
2000-09-12 00:08:48 +00:00