summaryrefslogtreecommitdiffhomepage
path: root/src/Makefile.am
AgeCommit message (Collapse)Author
2020-09-15prepare transition to poll()rofl0r
usage of select() is inefficient (because a huge fd_set array has to be initialized on each call) and insecure (because an fd >= FD_SETSIZE will cause out-of-bounds accesses using the FD_*SET macros, and a system can be set up to allow more than that number of fds using ulimit). for the moment we prepared a poll-like wrapper that still runs select() to test for regressions, and so we have fallback code for systems without poll().
2020-09-15replace leftover users of hashmap with htabrofl0r
also fixes a bug where the ErrorFile directive would create a new hashmap on every added item, effectively allowing only the use of the last specified errornumber, and producing memory leaks on each config reload.
2020-09-15save headers in an ordered dictionaryrofl0r
due to the usage of a hashmap to store headers, when relaying them to the other side the order was not prevented. even though correct from a standards point-of-view, this caused issues with various programs, and it allows to fingerprint the use of tinyproxy. to implement this, i imported the MIT-licensed hsearch.[ch] from https://github.com/rofl0r/htab which was originally taken from musl libc. it's a simple and efficient hashtable implementation with far better performance characteristic than the one previously used by tinyproxy. additionally it has an API much more well-suited for this purpose. orderedmap.[ch] was implemented from scratch to address this issue. behind the scenes it uses an sblist to store string values, and a htab to store keys and the indices into the sblist. this allows us to iterate linearly over the sblist and then find the corresponding key in the hash table, so the headers can be reproduced in the order they were received. closes #73
2019-12-21implement detection and denial of endless connection loopsrofl0r
it is quite easy to bring down a proxy server by forcing it to make connections to one of its own ports, because this will result in an endless loop spawning more and more connections, until all available fds are exhausted. since there's a potentially infinite number of potential DNS/ip addresses resolving to the proxy, it is impossible to detect an endless loop by simply looking at the destination ip address and port. what *is* possible though is to record the ip/port tuples assigned to outgoing connections, and then compare them against new incoming connections. if they match, the sender was the proxy itself and therefore needs to reject that connection. fixes #199.
2019-12-21simplify codebase by using one thread/conn, instead of preforked procsrofl0r
the existing codebase used an elaborate and complex approach for its parallelism: 5 different config file options, namely - MaxClients - MinSpareServers - MaxSpareServers - StartServers - MaxRequestsPerChild were used to steer how (and how many) parallel processes tinyproxy would spin up at start, how many processes at each point needed to be idle, etc. it seems all preforked processes would listen on the server port and compete with each other about who would get assigned the new incoming connections. since some data needs to be shared across those processes, a half- baked "shared memory" implementation was provided for this purpose. that implementation used to use files in the filesystem, and since it had a big FIXME comment, the author was well aware of how hackish that approach was. this entire complexity is now removed. the main thread enters a loop which polls on the listening fds, then spins up a new thread per connection, until the maximum number of connections (MaxClients) is hit. this is the only of the 5 config options left after this cleanup. since threads share the same address space, the code necessary for shared memory access has been removed. this means that the other 4 mentioned config option will now produce a parse error, when encountered. currently each thread uses a hardcoded default of 256KB per thread for the thread stack size, which is quite lavish and should be sufficient for even the worst C libraries, but people may want to tweak this value to the bare minimum, thus we may provide a new config option for this purpose in the future. i suspect that on heavily optimized C libraries such a musl, a stack size of 8-16 KB per thread could be sufficient. since the existing list implementation in vector.c did not provide a way to remove a single item from an existing list, i added my own list implementation from my libulz library which offers this functionality, rather than trying to add an ad-hoc, and perhaps buggy implementation to the vector_t list code. the sblist code is contained in an 80 line C file and as simple as it can get, while offering good performance and is proven bugfree due to years of use in other projects.
2018-09-01Remove unused authors.c/authors.h and generation mechanism.Michael Adam
Signed-off-by: Michael Adam <obnox@samba.org>
2018-03-23install tinyproxy to bin/, not /sbinrofl0r
sbin/ is meant for programs only usable by root, but in tinyproxy's case, regular users can and *should* use tinyproxy; meaning it is preferable from a security PoV to use tinyproxy as regular user.
2018-02-06move base64 code into own filerofl0r
it will be needed to add support for upstream proxy auth.
2018-02-06add support for basic HTTP authenticationrofl0r
using the "BasicAuth" keyword in tinyproxy.conf. base64 code was written by myself and taken from my own library "libulz". for this purpose it is relicensed under the usual terms of the tinyproxy license.
2017-03-27src/Makefile.am: fix spaces vs TABrofl0r
this causes a build failure on several platforms using older versions of autotools or GNU make. make[2]: Entering directory `src' Makefile:670: *** missing separator (did you mean TAB instead of 8 spaces?). Stop. make[2]: Leaving directory `src' fixes #72
2011-08-23Bug #103: Move files installed in /etc/ to /etc/tinyproxy/Mukund Sivaraman
2010-01-18Show authors and documenters when license is requestedMukund Sivaraman
2010-01-13Export configure variable localstatedir to C as define LOCALSTATEDIR.Michael Adam
So that it can be used for default values of some paths later on. Michael
2009-12-07Move handling of connect_ports list to its own source module.Michael Adam
Michael
2009-12-06move handling of upstream list to new module upstream.{c,h}Michael Adam
Michael
2009-09-21Rename conffile.[ch] to conf.[ch]Mukund Sivaraman
2009-09-20Remove ability to change the name of the default configuration fileMukund Sivaraman
This feature will only confuse us during support, if users come to us with a Tinyproxy build which has a differently named default config file. This feature is not that useful anyway.
2009-08-07Rename tinyproxy.[ch] to main.[ch]Mukund Sivaraman
2008-06-09Moved transparent proxy code into its own fileRobert James Kaes
Extracted the transparent proxy logic from reqs.c and placed it into a separate file. Signed-off-by: Robert James Kaes <rjk@wormbytes.ca>
2008-05-24Updated copyright header in Makefile.amMukund Sivaraman
2008-05-24Removed unnecessary LDFLAGS variableMukund Sivaraman
2008-05-24Renamed htmlerror.[ch] to html-error.[ch]Mukund Sivaraman
2008-03-13Removed the clean target from the src directoryMukund Sivaraman
This was overriding the automake clean target to clean up files like *.o by default.
2008-03-13Renamed file to replace underscores in it with dashesMukund Sivaraman
2008-03-13Renamed file to replace underscores in it with dashesMukund Sivaraman
2005-08-16* [Refactor] Moved Reverse Proxy CodeRobert James Kaes
Moved the reverse proxy code from reqs.c into it's own files (reverse_proxy.c). The code in reqs.c is way too complicated, so I want to move unrelated code into their own files to simplify the main concepts in reqs.c.
2005-07-12* Updated Copyright Email AddressesRobert James Kaes
Updated the copyright email addresses for Robert James Kaes. The users.sourceforge.net address should always exist.
2004-08-14Removed the last code relating to the old configuration parsingRobert James Kaes
system. The grammar.y and scanner.l files still need to be removed.
2004-08-13Removed the grammar.y and scanner.l files from the list of filesRobert James Kaes
required by tinyproxy.
2004-08-13Added the new configuration parsing system (conffile.c andRobert James Kaes
conffile.h.) The new system is intended to replace the existing grammar.y and scanner.l files. I don't want to depend on flex/bison any longer.
2003-08-07tinyproxy no longer includes a fall-back regular expression library,Robert James Kaes
so these files needed to be modified to only use the system's installed regular expression library.
2003-06-26# Added debugging flags for the flex scanner.Robert James Kaes
2003-03-13# Added htmlerror.c and htmlerror.hRobert James Kaes
2003-03-13# Include the http_message.[ch] into the compiled tinyproxy object.Robert James Kaes
2002-05-26Removed the "dnsserver" program all together, and changed the names ofRobert James Kaes
some of the files.
2002-05-23Added code to create the "dnsserver" program, and also reorganized toRobert James Kaes
include the various new source files.
2002-05-02tinyproxy should be installed into the /sbin directory rather than theRobert James Kaes
/bin directory since it's a network daemon.
2002-04-10Removed the dependency on LIBOBJS and instead use the ADDITIONAL_OBJECTSRobert James Kaes
variable in conjunction with _DEPENDENCIES and _LDADD. The change here makes filter a "required" module in the sense that it will always be compiled (to make sure it doesn't get out of date), but it will conditionally included in the object file.
2002-04-07Update the list of source code files to include the vector and hashmapRobert James Kaes
files.
2001-12-15Removed the references to ternary.c and ternary.hRobert James Kaes
2001-12-15Removed the references to dnscache.c and dnscache.hRobert James Kaes
2001-11-05Added a clean rule to remove the gprof files.Robert James Kaes
2001-10-25Some code clean up due to the creation of the conns.{c,h} files which nowRobert James Kaes
store the creation/destruction and definition of the connection structure.
2001-10-01Added the ability to compile tinyproxy with static linking.Robert James Kaes
2001-09-14Removed the reference to uri.c and uri.h since the new reqs.c doesn't useRobert James Kaes
them.
2000-09-11Modified to include all the files needed to build tinyproxy, plus theRobert James Kaes
special targets for building the LEX and YACC files. (Also included the GNU license.)
2000-03-31Added a line for the anonymous.* files.Robert James Kaes
2000-02-16This commit was generated by cvs2svn to compensate for changes in r2,Steven Young
which included commits to RCS files with non-trunk default branches.