diff options
| author | Laurent Bercot <ska-skaware@skarnet.org> | 2025-06-06 23:56:11 +0000 |
|---|---|---|
| committer | Laurent Bercot <ska@appnovation.com> | 2025-06-06 23:56:11 +0000 |
| commit | 592c13a20f5ece4a596635c75bf096ccd3dfa6b8 (patch) | |
| tree | e0d5ade907ffea45b8923430c19fb988cc13ee04 | |
| parent | 02a53683c3945626cdf2712172dbea9d168bf292 (diff) | |
| download | tipidee-592c13a20f5ece4a596635c75bf096ccd3dfa6b8.tar.gz | |
Prepare for 0.0.7.0; add noredirect
Signed-off-by: Laurent Bercot <ska@appnovation.com>
| -rw-r--r-- | INSTALL | 4 | ||||
| -rw-r--r-- | NEWS | 7 | ||||
| -rw-r--r-- | doc/index.html | 8 | ||||
| -rw-r--r-- | doc/tipidee.conf.html | 15 | ||||
| -rw-r--r-- | doc/upgrade.html | 9 | ||||
| -rw-r--r-- | package/info | 2 | ||||
| -rw-r--r-- | src/config/lexparse.c | 25 | ||||
| -rw-r--r-- | src/libtipidee/tipidee_conf_get_redirection.c | 5 |
8 files changed, 64 insertions, 11 deletions
@@ -6,8 +6,8 @@ Build Instructions - A POSIX-compliant C development environment - GNU make version 3.81 or later - - skalibs version 2.14.4.0 or later: https://skarnet.org/software/skalibs/ - - (optional but recommended): s6-networking version 2.7.1.0 or later: + - skalibs version 2.14.5.0 or later: https://skarnet.org/software/skalibs/ + - (optional but recommended): s6-networking version 2.7.2.0 or later: https://skarnet.org/software/s6-networking/ This software will run on any operating system that implements @@ -1,5 +1,12 @@ Changelog for tipidee. +In 0.0.7.0 +---------- + + - Support for shared libraries on MacOS. + - New directive: noredirect, to carve exceptions to generic redirections. + + In 0.0.6.0 ---------- diff --git a/doc/index.html b/doc/index.html index c25aeed..7f38212 100644 --- a/doc/index.html +++ b/doc/index.html @@ -111,11 +111,11 @@ make it shorter. Just like the code. <li> A POSIX-compliant system with a standard C development environment </li> <li> GNU make, version 3.81 or later </li> <li> <a href="//skarnet.org/software/skalibs/">skalibs</a> version -2.14.4.0 or later. It's a build-time requirement. It's also a run-time +2.14.5.0 or later. It's a build-time requirement. It's also a run-time requirement if you link against the shared version of the skalibs library. </li> <li> Recommended at run-time: <a href="//skarnet.org/software/s6-networking/">s6-networking</a> version -2.7.1.0 or later. It's not a strict requirement, but tipidee relies on a super-server such as +2.7.2.0 or later. It's not a strict requirement, but tipidee relies on a super-server such as <a href="//skarnet.org/software/s6-networking/s6-tcpserver.html">s6-tcpserver</a> to listen to the network and provide connection information via environment variables. It also defers to tools such as @@ -143,8 +143,8 @@ Don't take my word for it; try it out for yourself. </li> <ul> <li> The current released version of tipidee is -<a href="tipidee-0.0.6.0.tar.gz">0.0.6.0</a>. -You can access its checksum <a href="tipidee-0.0.6.0.tar.gz.sha256">here</a>. </li> +<a href="tipidee-0.0.7.0.tar.gz">0.0.6.0</a>. +You can access its checksum <a href="tipidee-0.0.7.0.tar.gz.sha256">here</a>. </li> <li> You can checkout a copy of the <a href="//git.skarnet.org/cgi-bin/cgit.cgi/tipidee/">tipidee git repository</a>: diff --git a/doc/tipidee.conf.html b/doc/tipidee.conf.html index f60fa32..a9b5063 100644 --- a/doc/tipidee.conf.html +++ b/doc/tipidee.conf.html @@ -847,6 +847,21 @@ requests received on port 443). But if you declare a redirection under the <tt>example.com</tt> domain, it will apply to requests received on <em>any</em> port. </li> </ul> +<div id="noredirect"> +<h4> <tt>noredirect</tt> </h4> +</div> + +<p> + <code> noredirect <em>resource</em> </code> +</p> + +<ul> + <li> This directive prevents <em>resource</em> from being redirected. It is typically +useful to carve exceptions to a generic redirection policy: if you have a <code>redirect</code> +directive for directory A and a <code>noredirect</code> directive for resource B, and A is +a prefix of B, then B will not be redirected, but everything else under A will. </li> +</ul> + <div id="custom-response"> <h4> <tt>custom-response</tt> </h4> </div> diff --git a/doc/upgrade.html b/doc/upgrade.html index 0bcfb28..e8447d5 100644 --- a/doc/upgrade.html +++ b/doc/upgrade.html @@ -18,6 +18,15 @@ <h1> What has changed in tipidee </h1> +<h2> in 0.0.7.0 </h2> + +<ul> + <li> <a href="//skarnet.org/software/skalibs/">skalibs</a> +dependency bumped to 2.14.5.0 </li> + <li> <a href="//skarnet.org/software/s6-networking/">s6-networking</a> +recommendation bumped to 2.7.2.0 </li> +</ul> + <h2> in 0.0.6.0 </h2> <ul> diff --git a/package/info b/package/info index 27a9f82..bd008d1 100644 --- a/package/info +++ b/package/info @@ -1,4 +1,4 @@ package=tipidee -version=0.0.6.0 +version=0.0.7.0 category=web package_macro_name=TIPIDEE diff --git a/src/config/lexparse.c b/src/config/lexparse.c index 160aa97..ad22762 100644 --- a/src/config/lexparse.c +++ b/src/config/lexparse.c @@ -44,6 +44,7 @@ enum directivevalue_e T_DOMAIN, T_NPHPREFIX, T_REDIRECT, + T_NOREDIRECT, T_CGI, T_NONCGI, T_NPH, @@ -245,6 +246,26 @@ static inline void parse_customheader (char const *s, size_t const *word, size_t } } +static inline void parse_noredirect (char const *s, size_t const *word, size_t n, char const *domain, size_t domainlen, mdt const *md) +{ + if (n != 1) + strerr_dief8x(1, "too ", n > 1 ? "many" : "few", " arguments to directive ", "noredirect", " in file ", g.storage.s + md->filepos, " line ", md->linefmt) ; + if (!domain) + strerr_dief6x(1, "noredirection", " without a domain directive", " in file ", g.storage.s + md->filepos, " line ", md->linefmt) ; + if (s[*word] != '/') + strerr_dief6x(1, "noredirected resource", " must start with /", " in file ", g.storage.s + md->filepos, " line ", md->linefmt) ; + { + size_t urlen = strlen(s + *word) ; + char key[3 + domainlen + urlen] ; + if (s[*word + urlen - 1] == '/') { key[0] = 'r' ; urlen-- ; } else key[0] = 'R' ; + key[1] = ':' ; + memcpy(key + 2, domain, domainlen) ; + memcpy(key + 2 + domainlen, s + *word, urlen) ; + key[2 + domainlen + urlen] = 0 ; + add_unique(key, " ", 2, md) ; + } +} + static inline void parse_redirect (char const *s, size_t const *word, size_t n, char const *domain, size_t domainlen, mdt const *md) { static uint32_t const codes[4] = { 307, 308, 302, 301 } ; @@ -425,6 +446,7 @@ static inline void process_line (char const *s, size_t const *word, size_t n, st { .name = "noautochunk", .value = T_NOAUTOCHUNK }, { .name = "noncgi", .value = T_NONCGI }, { .name = "nonnph", .value = T_NONNPH }, + { .name = "noredirect", .value = T_NOREDIRECT }, { .name = "nph", .value = T_NPH }, { .name = "nph-prefix", .value = T_NPHPREFIX }, { .name = "redirect", .value = T_REDIRECT }, @@ -492,6 +514,9 @@ static inline void process_line (char const *s, size_t const *word, size_t n, st case T_REDIRECT : parse_redirect(s, word, n, domain->s, domain->len, md) ; break ; + case T_NOREDIRECT : + parse_noredirect(s, word, n, domain->s, domain->len, md) ; + break ; case T_CGI : parse_bitattr(s, word, n, domain->s, domain->len, md, 0, 1) ; break ; diff --git a/src/libtipidee/tipidee_conf_get_redirection.c b/src/libtipidee/tipidee_conf_get_redirection.c index b117481..9554227 100644 --- a/src/libtipidee/tipidee_conf_get_redirection.c +++ b/src/libtipidee/tipidee_conf_get_redirection.c @@ -3,8 +3,6 @@ #include <errno.h> #include <string.h> -#include <skalibs/lolstdio.h> - #include <tipidee/conf.h> #include <skalibs/posixishard.h> @@ -24,12 +22,11 @@ static int get_redir (tipidee_conf const *conf, size_t minl, char *key, size_t l v = tipidee_conf_get_string(conf, key) ; key[0] = 'r' ; } - if (!v) return 0 ; + if (!v || v[0] == ' ') return 0 ; if (v[0] < '@' || v[0] > 'C') return (errno = EPROTO, -1) ; r->type = v[0] & ~'@' ; r->location = v+1 ; r->sub = path + (l - minl + 1) ; - LOLDEBUG("get_redir: found redirection of type %c to %s with sub %s", v[0], r->location, r->sub) ; return 1 ; } |
