summaryrefslogtreecommitdiffhomepage
AgeCommit message (Collapse)Author
2021-06-11WIP: caresbuildMikael Magnusson
2021-06-11WIP: caresMikael Magnusson
2021-06-10WIP: caresMikael Magnusson
2021-06-10WIP: cares resolversMikael Magnusson
2021-06-10Merge branches 'bind-ipv4mapped' and 'support_http_11' into buildMikael Magnusson
2021-06-10debug bindMikael Magnusson
2021-06-10fix memcpy sizeMikael Magnusson
2021-06-10WIPMikael Magnusson
2021-06-10WIP: BindIPv6MappedMikael Magnusson
2021-06-10WIP: BindIPv4MappedMikael Magnusson
2021-05-13Include limits.h to fix build on OSXAlex Wied
2021-05-13github actions: don't run "make test" on macos it currenctly failsMichael Adam
Signed-off-by: Michael Adam <obnox@samba.org>
2021-05-13github actions: add macos testsMichael Adam
Signed-off-by: Michael Adam <obnox@samba.org>
2021-05-12Fix github actionsMichael Adam
Signed-off-by: Michael Adam <obnox@samba.org>
2021-05-12Add github actions workflow for new CIMichael Adam
Signed-off-by: Michael Adam <obnox@samba.org>
2021-05-10manpage: improve FilterDefaultDeny paragraphrofl0r
2021-05-10conf: do not warn about missing user directive unless rootrofl0r
there's no point in printing a warning if the program is already started as a restricted user.
2021-05-09filter: hard error when filter file doesn't existrofl0r
2021-05-09manpage: URL-based filtering is no longer recommendedrofl0r
2021-04-16add support for outgoing connections with HTTP/1.1rofl0r
since there are numerous changes in HTTP/1.1, the proxyserver will stick to using HTTP/1.0 for internal usage, however when a connection is requested with HTTP/1.x from now on we will duplicate the minor revision the client requested, because apparently some servers refuse to accept HTTP/1.0 addresses #152.
2021-04-16make upstream site-spec ipv6 compatible, refactor acl coderofl0r
the acl.c code parsing a site-spec has been factored out into a new TU: hostspec. it was superior to the parsing code in upstream.c in that it properly deals with both ipv4 and ipv6. both upstream and acl now use the new code for parsing, and upstream also for checking for a match. acl.c still uses the old matching code as it has a lot of special case code for specifications containing a hostname, and in case such a spec is encountered, tries to do reverse name lookup to see if a numeric ip matches that spec. removing that code could break existing usecases, however since that was never implemented for upstream nobody will miss it there.
2021-04-16reverse: redirect if path without trailing slash is detectedrofl0r
if for example: ReversePath = "/foo/" and user requests "http://tinyproxy/foo" the common behaviour for HTTP servers is to send a http 301 redirect to the correct url. we now do the same.
2021-04-16Release 1.11.0rofl0r
2021-03-28reverse: ensure paths always end with a slashrofl0r
2021-03-28htab: prevent filling up of table with tombstonesrofl0r
as pointed out by @craigbarnes [0], using the latest fix for the tombstone issue, it's possible to provoke a situation that causes an endless loop when all free slots in the table are filled up with tombstones and htab_find() is called. therefore we need to account for those as well when deciding if there's a need to call resize() so there's never more than 75% of the table used by either dead or live items. the resize() serves as a rehash which gets rid of all deleted entries, and it might cause the table size to shrink if htab_insert() is called after a lot of items have been removed. [0]: https://github.com/rofl0r/htab/issues/1#issuecomment-800094442 testcase: #include <assert.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include "hsearch.h" #define HTAB_OOM_TEST #include "hsearch.c" static char *xstrdup(const char *str) { char *dup = strdup(str); assert(dup); return dup; } void utoa(unsigned number, char* buffer) { int lentest, len = 0, i, start = 0; lentest = number; do { len++; lentest /= 10; } while(lentest); buffer[start+len] = 0; do { i = number % 10; buffer[start+len - 1] = '0' + i; number -= i; len -= 1; number /= 10; } while (number); } #define TESTSIZE 8 #define KEEP 1 static char* notorious[TESTSIZE]; static void prep() { srand(0); char buf[16]; size_t filled = 0; while(filled < TESTSIZE) { utoa(rand(), buf); size_t idx = keyhash(buf) & (TESTSIZE-1); if(!notorious[idx]) { notorious[idx] = xstrdup(buf); ++filled; } } } int main(void) { struct htab *h = htab_create(TESTSIZE); size_t i; assert(h); prep(); for(i=0; i<TESTSIZE; ++i) { char *key = notorious[i]; printf("[%zu] = \"%s\"\n", i, key); int r = htab_insert(h, key, HTV_N(42)); if(!r == 1) { printf("element %zu couldn't be inserted\n", i); break; } assert(r == 1); // Ensure newly inserted entry can be found assert(htab_find(h, key)); if(i >= KEEP) htab_delete(h, key); } htab_find(h, "looooop"); return 0; }
2021-03-28refactor html-error so send_http_headers() can take extra argrofl0r
we already required an extra argument inside the headers sent for 401 and 407 error responses, move those to sent_http_error_message() and refactor send_http_headers() to always take the extra argument. in calling sites where the extra arg isn't needed, use "".
2021-03-14orderedmap: fix memory leak when using orderedmap_remove()rofl0r
closes #351
2021-03-14htab_delete(): fix failure to set tombstonerofl0r
we can't just set an item's key to zero and be done with a deletion, because this will break the item search chain. a deleted item requires a special marker, also known as tombstone. when searching for an item, all slots with a tombstone need to treated as if they were in use, but when inserting an item such a slot needs to be filled with the new item. a common procedure is to rehash the table when the number of deleted items crosses a certain threshold, though for simplicity we leave this task to the resize() function which does the same thing anyway when the hashtable grows. this allows to fix the issue quite elegantly and with almost no additional overhead, so we don't penalize applications that do very few deletions.
2021-02-13configure: check whether gperf is compatiblerofl0r
closes #337
2020-10-19http-message: fix UB passing long to format string expecting introfl0r
2020-10-19reqs: fix UB passing ssize_t to format string expecting introfl0r
2020-10-19log: replace non-mt-safe localtime() with localtime_r()rofl0r
2020-10-19replace usage of non-threadsafe gmtime() with gmtime_r()rofl0r
the latter is a standard POSIX function too.
2020-10-19Allow multiple Bind directives.Anton Khirnov
Try all the addresses specified with Bind in order. This is necessary e.g. for maintaining IPv4+6 connectivity while still being restricted to one interface.
2020-10-19sock: add missing format specifier to log_message()Anton Khirnov
2020-10-19log.c: fix format string argsrofl0r
2020-10-19html-error: move common.h inclusion back to toprofl0r
this seems to cause an implicit declaration of snprintf() thanks to feature test macro hell.
2020-10-01conf: move inclusion of common.h back to the startrofl0r
otherwise the feature-test-macros won't kick in as they should. should fix #329
2020-09-30acl: fix regression using ipv6 with netmaskrofl0r
introduced in 0ad8904b40d699405f60655606db42475c011b67 closes #327
2020-09-30conf: only treat space and tab as whitespacerofl0r
other characters in the [[:space:]] set can't possibly be encountered, and this speeds up parsing by approximately 10%.
2020-09-30conf: use [0-9] instead of [[:digit:]] for shorter re stringsrofl0r
2020-09-30print linenumber from all conf-emitted warningsrofl0r
2020-09-30log: print timestamps with millisecond precisionrofl0r
this allows easier time measurements for benchmarks.
2020-09-30change loglevel of "Not running as root" message to INFOrofl0r
there's no reason to display this as warning.
2020-09-30conf: remove bogus support for hex literalsrofl0r
the INT regex macro supported a 0x prefix (used e.g. for port numbers), however following that, only digits were accepted, and not the full range of hexdigits. it's unlikely this was used, so remove it. note that the () expression is kept, so we don't have to adjust match number indices all over the place.
2020-09-30speed up build by only including regex.h where neededrofl0r
2020-09-27Release 1.11.0-rc1rofl0r
2020-09-27add conf-tokens.gperf to EXTRA_DISTrofl0r
otherwise it will be missing in `make dist`-generated tarballs.
2020-09-27version.sh: relax regex for release tag detectionrofl0r
this allows to use tag names with a custom suffix too.
2020-09-27version.sh: replace -g with -git-rofl0r
git describe prefixes the sha1 commit hash with -g, which is exactly what we're after. this change gets rid of the confusing "g" in the commit hash and allows tag names that include "-".