diff options
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | .travis.yml | 18 | ||||
-rw-r--r-- | ChangeLog | 1 | ||||
-rw-r--r-- | Makefile.am | 3 | ||||
-rw-r--r-- | README | 104 | ||||
-rw-r--r-- | README.md | 92 | ||||
-rw-r--r-- | configure.ac | 20 | ||||
-rw-r--r-- | docs/man5/Makefile.am | 3 | ||||
-rw-r--r-- | docs/man8/Makefile.am | 3 | ||||
-rw-r--r-- | src/hashmap.c | 21 | ||||
-rw-r--r-- | src/hashmap.h | 5 | ||||
-rw-r--r-- | src/html-error.c | 25 |
12 files changed, 166 insertions, 130 deletions
@@ -18,5 +18,6 @@ stamp-h1 autom4te.cache cscope.files cscope.out +compile *~ tags diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..c38a1d2 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,18 @@ +language: C +dist: trusty +sudo: true + +before_install: +- sudo apt-get update -qq +- sudo apt-get install --assume-yes asciidoc valgrind + +script: +- ./autogen.sh +- ./configure +- make +- make test +- ./configure --enable-debug --enable-transparent --enable-reverse +- make +- make test +- make valgrind-test +- make distcheck diff --git a/ChangeLog b/ChangeLog new file mode 100644 index 0000000..c4ee927 --- /dev/null +++ b/ChangeLog @@ -0,0 +1 @@ +The ChangeLog is maintained in the git history. diff --git a/Makefile.am b/Makefile.am index 3138f37..9d62d2c 100644 --- a/Makefile.am +++ b/Makefile.am @@ -29,7 +29,8 @@ check-local: validate-authors dist_doc_DATA = \ AUTHORS \ NEWS \ - README + README \ + README.md EXTRA_DIST = \ authors.dtd \ @@ -1,103 +1 @@ -Tinyproxy -========= - -Tinyproxy is a small, efficient HTTP/SSL proxy daemon released under the -GNU General Public License. Tinyproxy is very useful in a small network -setting, where a larger proxy would either be too resource intensive, or -a security risk. One of the key features of Tinyproxy is the buffering -connection concept. In effect, Tinyproxy will buffer a high speed -response from a server, and then relay it to a client at the highest -speed the client will accept. This feature greatly reduces the problems -with sluggishness on the Internet. If you are sharing an Internet -connection with a small network, and you only want to allow HTTP -requests to be allowed, then Tinyproxy is a great tool for the network -administrator. - -For more info, please visit: - -<https://tinyproxy.github.io/> - - -Installation ------------- - -To install this package under a UNIX derivative, read the INSTALL file. -Tinyproxy uses a standard GNU `configure` script. Basically you should -be able to do: - ----- -./configure -make -make install ----- - -in the top level directory to compile and install Tinyproxy. There are -additional command line arguments you can supply to `configure`. They -include: - ---enable-debug:: - If you would like to turn on full debugging support. - ---enable-xtinyproxy:: - Compile in support for the XTinyproxy header, which is sent to any - web server in your domain. - ---enable-filter:: - Allows Tinyproxy to filter out certain domains and URLs. - ---enable-upstream:: - Enable support for proxying connections through another proxy server. - ---enable-transparent:: - Allow Tinyproxy to be used as a transparent proxy daemon. - ---enable-static:: - Compile a static version of Tinyproxy. - ---with-stathost=HOST:: - Set the default name of the stats host. - - -Support -------- - -If you are having problems with Tinyproxy, please submit a bug report -using Tinyproxy as the product at: - -<https://banu.com/bugzilla/> - -You may also wish to subscribe to the Tinyproxy mailing lists. To do so -please visit: - -<https://banu.com/mailman/listinfo/tinyproxy-announce-list> - -<https://banu.com/mailman/listinfo/tinyproxy-list> - -for more information on how to subscribe and post messages to the lists. - - -Contributing ------------- - -If you would like to contribute a feature, or a bug fix to the Tinyproxy -source, please send a patch (preferably as a unified diff. i.e. `diff --u` against the 'master' branch of the Tinyproxy source code git -repository to 'tinyproxy-developers-list'. Please include a description -of what your patch does. - -Tinyproxy's source code is maintained in a Git repository. The following -command creates a local copy of it: - ----- -git clone git://banu.com/tinyproxy.git ----- - -The easiest and preferred way to create a patch for submission is to -check in your changes locally against the 'master' branch and use `git -format-patch` to generate a mbox-style patch file that contains the diff -along with the commit message and author information. Such a formatted -patch file can be integrated into the upstream repository, automatically -keeping the commit message and author information. - -You can also meet developers and discuss development issues and patches -in the `#tinyproxy` IRC channel on Freenode (`irc.freenode.net`). +see README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..2cb8d59 --- /dev/null +++ b/README.md @@ -0,0 +1,92 @@ +# Tinyproxy + +Tinyproxy is a small, efficient HTTP/SSL proxy daemon released under the +GNU General Public License. Tinyproxy is very useful in a small network +setting, where a larger proxy would either be too resource intensive, or +a security risk. One of the key features of Tinyproxy is the buffering +connection concept. In effect, Tinyproxy will buffer a high speed +response from a server, and then relay it to a client at the highest +speed the client will accept. This feature greatly reduces the problems +with sluggishness on the Internet. If you are sharing an Internet +connection with a small network, and you only want to allow HTTP +requests to be allowed, then Tinyproxy is a great tool for the network +administrator. + +For more info, please visit [the Tinyproxy web site](https://tinyproxy.github.io/). + + +## Installation + +Tinyproxy uses a standard GNU `configure` script based on the automake +system. If compiling from a git checkout, you need to first run + +``` +./autogen.sh +``` + +from the top level directory to generate the `configure` script. +The release tarball contains the pre-created `configure` script, +so when building fom a release, you can skip this step. +Then basically all you need to do is + + +``` +./configure +make +make install +``` + +in the top level directory to compile and install Tinyproxy. There are +additional command line arguments you can supply to `configure`. They +include: + +- `--enable-debug`: +If you would like to turn on full debugging support. + +- `--enable-xtinyproxy`: +Compile in support for the XTinyproxy header, which is sent to any +web server in your domain. + +- `--enable-filter`: +Allows Tinyproxy to filter out certain domains and URLs. + +- `--enable-upstream`: +Enable support for proxying connections through another proxy server. + +- `--enable-transparent`: +Allow Tinyproxy to be used as a transparent proxy daemon. + +- `--enable-static`: +Compile a static version of Tinyproxy. + +- `--enable-reverse`: +Enable reverse proxying. + +- `--with-stathost=HOST`: +Set the default name of the stats host. + +For more information about the build system, read the INSTALL file +that is generated by `autogen.sh` and comes with the release tar ball. + + + +## Support + + +If you are having problems with Tinyproxy, please raise an +[issue on github](https://github.com/tinyproxy/tinyproxy/issues). + + +## Contributing + +If you would like to contribute a feature, or a bug fix to the Tinyproxy +source, please clone the +[git repository from github](https://github.com/tinyproxy/tinyproxy.git) +and create a [pull request](https://github.com/tinyproxy/tinyproxy/pulls). + + +## Community + +You can meet developers and users to discuss development, +patches and deployment issues in the `#tinyproxy` IRC channel on +Freenode (`irc.freenode.net`). diff --git a/configure.ac b/configure.ac index 1893945..3990c2f 100644 --- a/configure.ac +++ b/configure.ac @@ -251,9 +251,6 @@ AM_CONDITIONAL(HAVE_XSLTPROC, test "x$XSLTPROC" != "xno") # Check for asciidoc AC_PATH_PROG(A2X, a2x, no) AM_CONDITIONAL(HAVE_A2X, test "x$A2X" != "xno") -if test x"$A2X" = x"no"; then - AC_MSG_ERROR([Test for asciidoc failed. See the file 'INSTALL' for help.]) -fi # checking xmllint AC_PATH_PROG(XMLLINT, xmllint, no) @@ -287,3 +284,20 @@ tests/scripts/Makefile ]) AC_OUTPUT + +# the manpages are shipped in the release tarball and we don't want them to +# get regenerated if a2x is not available. the intermediate files from +# AC_CONFIG_FILES are created with config.status, which is created at configure +# runtime, so we need to touch them after config.status terminated to prevent +# make from rebuild them. + +if test "x$A2X" = "xno"; then + touch docs/man5/tinyproxy.conf.txt + touch docs/man8/tinyproxy.txt + if test -e docs/man5/tinyproxy.conf.5 ; then + touch docs/man5/tinyproxy.conf.5 + fi + if test -e docs/man8/tinyproxy.8 ; then + touch docs/man8/tinyproxy.8 + fi +fi diff --git a/docs/man5/Makefile.am b/docs/man5/Makefile.am index f64636a..247b7ef 100644 --- a/docs/man5/Makefile.am +++ b/docs/man5/Makefile.am @@ -20,3 +20,6 @@ endif CLEANFILES = \ $(MAN5_FILES:.txt=.5) \ $(MAN5_FILES:.txt=.xml) + +EXTRA_DIST = \ + $(MAN5_FILES:.txt=.5) diff --git a/docs/man8/Makefile.am b/docs/man8/Makefile.am index ad4c010..1bd0ffa 100644 --- a/docs/man8/Makefile.am +++ b/docs/man8/Makefile.am @@ -20,3 +20,6 @@ endif CLEANFILES = \ $(MAN8_FILES:.txt=.8) \ $(MAN8_FILES:.txt=.xml) + +EXTRA_DIST= \ + $(MAN8_FILES:.txt=.8) diff --git a/src/hashmap.c b/src/hashmap.c index b99f838..7793d08 100644 --- a/src/hashmap.c +++ b/src/hashmap.c @@ -493,3 +493,24 @@ ssize_t hashmap_remove (hashmap_t map, const char *key) /* The key was not found, so return 0 */ return deleted; } + +/* + * Look up the value for a variable. + */ +char *lookup_variable (hashmap_t map, const char *varname) +{ + hashmap_iter result_iter; + char *key; + char *data; + + result_iter = hashmap_find (map, varname); + + if (hashmap_is_end (map, result_iter)) + return (NULL); + + if (hashmap_return_entry (map, result_iter, + &key, (void **) &data) < 0) + return (NULL); + + return (data); +} diff --git a/src/hashmap.h b/src/hashmap.h index e8fa819..9206737 100644 --- a/src/hashmap.h +++ b/src/hashmap.h @@ -117,4 +117,9 @@ extern ssize_t hashmap_search (hashmap_t map, const char *key); */ extern ssize_t hashmap_remove (hashmap_t map, const char *key); +/* + * Look up the value for a variable. + */ +extern char *lookup_variable (hashmap_t map, const char *varname); + #endif /* _HASHMAP_H */ diff --git a/src/html-error.c b/src/html-error.c index 972d265..38adf85 100644 --- a/src/html-error.c +++ b/src/html-error.c @@ -84,27 +84,6 @@ static char *get_html_file (unsigned int errornum) } /* - * Look up the value for a variable. - */ -static char *lookup_variable (struct conn_s *connptr, const char *varname) -{ - hashmap_iter result_iter; - char *key; - char *data; - - result_iter = hashmap_find (connptr->error_variables, varname); - - if (hashmap_is_end (connptr->error_variables, result_iter)) - return (NULL); - - if (hashmap_return_entry (connptr->error_variables, result_iter, - &key, (void **) &data) < 0) - return (NULL); - - return (data); -} - -/* * Send an already-opened file to the client with variable substitution. */ int @@ -126,7 +105,7 @@ send_html_file (FILE *infile, struct conn_s *connptr) if (in_variable) { *p = '\0'; varval = (const char *) - lookup_variable (connptr, + lookup_variable (connptr->error_variables, varstart); if (!varval) varval = "(unknown)"; @@ -212,7 +191,7 @@ int send_http_error_message (struct conn_s *connptr) error_file = get_html_file (connptr->error_number); if (!(infile = fopen (error_file, "r"))) { - char *detail = lookup_variable (connptr, "detail"); + char *detail = lookup_variable (connptr->error_variables, "detail"); return (write_message (connptr->client_fd, fallback_error, connptr->error_number, connptr->error_string, |