summaryrefslogtreecommitdiffhomepage
path: root/src/html-error.c
AgeCommit message (Collapse)Author
2020-09-07html-error: substitute template variables via a regexrofl0r
previously, in order to detect and insert {variables} into error/stats templates, tinyproxy iterated char-by-char over the input file, and would try to parse anything inside {} pairs and treat it like a variable name. this breaks CSS, and additionally it's dog slow as tinyproxy wrote every single character to the client via a write syscall. now we process line-by-line, and inspect all matches of the regex \{[a-z]{1,32}\}. if the contents of the regex are a known variable name, substitution is taking place. if not, the contents are passed as-is to the client. also the chunks before and after matches are written in a single syscall. closes #108
2020-09-06send_html_file(): also set empty variables to "(unknown)"rofl0r
2020-01-15access config via a pointer, not a hardcoded struct addressrofl0r
this is required so we can elegantly swap out an old config for a new one in the future and remove lots of boilerplate from config initialization code. unfortunately this is a quite intrusive change as the config struct was accessed in numerous places, but frankly it should have been done via a pointer right from the start. right now, we simply point to a static struct in main.c, so there shouldn't be any noticeable changes in behaviour.
2019-12-21do hostname resolution only when it is absolutely necessary for ACL checkrofl0r
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-06-14fix usage of stathost in combination with basic authrofl0r
http protocol requires different treatment of proxy auth vs server auth. fixes #246
2018-03-27html-error: Make a switch fallthrough explicitMichael Adam
This silences a gcc v7 compile warning. Signed-off-by: Michael Adam <obnox@samba.org>
2018-02-06Basic Auth: send correct response codes and headers acc. to rfc7235rofl0r
as reported by @natedogith1
2016-12-27Move lookup_variable into hashmap.c / hashmap.hGreg
2016-12-27Change signature for lookup_variable to take map instead of connptrGreg
2016-01-03update URLrofl0r
2011-02-28Update URLs of TinyproxyMukund Sivaraman
2010-03-28Revert "Update Tinyproxy website URLs"Mukund Sivaraman
This reverts commit b108162dfb408b4818a6ea8b2a148ddaf1506bbe.
2010-03-27Update Tinyproxy website URLsMukund Sivaraman
2010-01-25Remove bogus static qualifiers for these auto variablesMukund Sivaraman
2010-01-16Use HTTPS link in URLs to Tinyproxy websitesMukund Sivaraman
2009-12-07Move definition of "struct config_s" from main.h to conf.hMichael Adam
Michael
2009-10-02Clean up html_send_file ()Mukund Sivaraman
- Make function return from one place - Move inbuf to the heap
2009-09-15Indent code to Tinyproxy coding styleMukund Sivaraman
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-08-07send_html_file(): remove a discards qualifyer warningMichael Adam
and untangle assignment from check. Michael
2009-08-07html-error: make read only argument const in lookup_variable().Michael Adam
Michael
2009-08-07make a const string const in send_http_error_message().Michael Adam
Michael
2009-08-07make a const string const in send_http_headers().Michael Adam
Michael
2009-08-07make message argument of indicate_http_error() const.Michael Adam
Michael
2009-08-07make message argument to send_http_headers() constant.Michael Adam
Michael
2009-08-07add_error_variable(): make key and data arguments constMichael Adam
Michael
2009-08-07Rename tinyproxy.[ch] to main.[ch]Mukund Sivaraman
2008-12-08Convert tabs to spacesMukund Sivaraman
2008-12-08Update Tinyproxy website URLMukund Sivaraman
2008-12-08Break at 80 columnsMukund Sivaraman
2008-12-01Reformat code to GNU coding styleMukund Sivaraman
This is a commit which simply ran all C source code files through GNU indent. No other modifications were made.
2008-07-14Fix a regression where empty error variables caused strlen() to crashMukund Sivaraman
This fixes a regression (bug #16) introduced in 95c1f39f6039dc82346f3e024e86a23b7103a0a6, where a NULL check was removed. This caused NULL error variable values to be sent to add_error_variable() in which strlen() segfaulted. With this fix, custom stats pages should be displayed properly. X-Banu-Bugzilla-Ids: 16
2008-07-14Make the embedded error message display valid XHTML tooMukund Sivaraman
Also fix the information that is displayed.
2008-07-14Add error number as a template parameter for error pagesMukund Sivaraman
2008-07-14Spruce up error page footers a bitMukund Sivaraman
2008-06-10Don't check the value to be inserted as it's already checkedMukund Sivaraman
This change primarily avoids a gcc warning where timebuf is never non-NULL. There is no need to check the value to be inserted as it's checked inside hashmap_insert(). This changeset also lets error return values from hashmap_insert() propogate instead of clamping them to -1 (not that these are currently used anyway).
2008-05-24Renamed htmlerror.[ch] to html-error.[ch]Mukund Sivaraman