tinyproxy/src
rofl0r 34a8b28414 save headers in an ordered dictionary
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
2020-09-15 23:11:59 +01:00
..
.gitignore Removed obsolete ignore rules 2008-06-19 21:33:20 +05:30
Makefile.am save headers in an ordered dictionary 2020-09-15 23:11:59 +01:00
acl.c make acl lookup 450x faster by using sblist 2020-09-07 22:09:35 +01:00
acl.h make acl lookup 450x faster by using sblist 2020-09-07 22:09:35 +01:00
anonymous.c anonymous: fix segfault loading config item 2020-03-16 13:19:39 +00:00
anonymous.h anonymous: fix segfault loading config item 2020-03-16 13:19:39 +00:00
base64.c move base64 code into own file 2018-02-06 16:57:02 +00:00
base64.h move base64 code into own file 2018-02-06 16:57:02 +00:00
basicauth.c fix basicauth string comparison 2018-03-29 00:40:18 +01:00
basicauth.h basicauth.[ch]: refactor to make basicauth_string() reusable 2018-02-25 15:13:45 +00:00
buffer.c buffer: fix log message in read_buffer(). 2013-11-23 12:21:59 +01:00
buffer.h Convert tabs to spaces 2008-12-08 13:39:44 +00:00
child.c shutdown: free children from right place 2020-09-15 22:32:42 +01:00
child.h shutdown: free children from right place 2020-09-15 22:32:42 +01:00
common.h configure: do not check for standard POSIX headers 2016-12-21 21:01:37 +00:00
conf.c fix free()ing of config items 2020-09-15 23:11:59 +01:00
conf.h fix free()ing of config items 2020-09-15 23:11:59 +01:00
connect-ports.c Remove unnecessary cast to (void **) 2010-01-25 21:36:18 +05:30
connect-ports.h Add free_connect_ports_list(). 2009-12-07 00:22:52 +01:00
conns.c do hostname resolution only when it is absolutely necessary for ACL check 2019-12-21 00:43:45 +00:00
conns.h do hostname resolution only when it is absolutely necessary for ACL check 2019-12-21 00:43:45 +00:00
daemon.c daemon.c: fix #if NDEBUG --> #ifdef NDEBUG 2009-11-10 17:59:40 +01:00
daemon.h Reformat code to GNU coding style 2008-12-01 15:01:11 +00:00
filter.c filter: reduce memory usage, fix OOM crashes 2020-09-05 19:42:34 +01:00
filter.h filter: reduce memory usage, fix OOM crashes 2020-09-05 19:42:34 +01:00
hashmap.c Move lookup_variable into hashmap.c / hashmap.h 2016-12-27 12:23:51 -05:00
hashmap.h Move lookup_variable into hashmap.c / hashmap.h 2016-12-27 12:23:51 -05:00
heap.c simplify codebase by using one thread/conn, instead of preforked procs 2019-12-21 00:43:45 +00:00
heap.h simplify codebase by using one thread/conn, instead of preforked procs 2019-12-21 00:43:45 +00:00
hsearch.c save headers in an ordered dictionary 2020-09-15 23:11:59 +01:00
hsearch.h save headers in an ordered dictionary 2020-09-15 23:11:59 +01:00
html-error.c add_new_errorpage(): fix segfault accessing global config 2020-09-12 21:38:04 +01:00
html-error.h add_new_errorpage(): fix segfault accessing global config 2020-09-12 21:38:04 +01:00
http-message.c Indent code to Tinyproxy coding style 2009-09-15 01:11:25 +05:30
http-message.h http_message_add_headers: make argument num_headers unsigned 2009-08-07 09:24:32 +02:00
log.c access config via a pointer, not a hardcoded struct address 2020-01-15 16:09:41 +00:00
log.h make send_stored_logs static 2018-02-25 18:35:34 +00:00
loop.c implement detection and denial of endless connection loops 2019-12-21 00:43:45 +00:00
loop.h implement detection and denial of endless connection loops 2019-12-21 00:43:45 +00:00
main.c fix free()ing of config items 2020-09-15 23:11:59 +01:00
main.h remove duplicate code calling reload_config_file() 2020-01-15 16:35:43 +00:00
network.c safe_write/read: take void* buffer for generic use 2017-12-04 11:33:01 +00:00
network.h safe_write/read: take void* buffer for generic use 2017-12-04 11:33:01 +00:00
orderedmap.c save headers in an ordered dictionary 2020-09-15 23:11:59 +01:00
orderedmap.h save headers in an ordered dictionary 2020-09-15 23:11:59 +01:00
reqs.c save headers in an ordered dictionary 2020-09-15 23:11:59 +01:00
reqs.h do hostname resolution only when it is absolutely necessary for ACL check 2019-12-21 00:43:45 +00:00
reverse-proxy.c save headers in an ordered dictionary 2020-09-15 23:11:59 +01:00
reverse-proxy.h save headers in an ordered dictionary 2020-09-15 23:11:59 +01:00
sblist.c simplify codebase by using one thread/conn, instead of preforked procs 2019-12-21 00:43:45 +00:00
sblist.h simplify codebase by using one thread/conn, instead of preforked procs 2019-12-21 00:43:45 +00:00
sock.c access config via a pointer, not a hardcoded struct address 2020-01-15 16:09:41 +00:00
sock.h do hostname resolution only when it is absolutely necessary for ACL check 2019-12-21 00:43:45 +00:00
stats.c access config via a pointer, not a hardcoded struct address 2020-01-15 16:09:41 +00:00
stats.h Indent code to Tinyproxy coding style 2009-09-15 01:11:25 +05:30
text.c Indent code to Tinyproxy coding style 2009-09-15 01:11:25 +05:30
text.h Reformat code to GNU coding style 2008-12-01 15:01:11 +00:00
transparent-proxy.c save headers in an ordered dictionary 2020-09-15 23:11:59 +01:00
transparent-proxy.h save headers in an ordered dictionary 2020-09-15 23:11:59 +01:00
upstream.c upstream: fix ip/mask calculation for types other than none 2020-09-07 16:11:51 +01:00
upstream.h rename members of proxy_type enum to have a common prefix 2018-02-25 23:52:23 +00:00
utils.c Use correct format string for POSIX pid_t in pidfile_create() 2009-09-27 08:09:24 +05:30
utils.h Convert tabs to spaces 2008-12-08 13:39:44 +00:00
vector.c Make position into an enum 2009-11-17 01:52:23 +05:30
vector.h vector.h: missing include <unistd.h> for ssize_t 2020-09-12 15:56:36 +01:00