phroxy

Gopher to HTTP proxy
git clone git://git.z3bra.org/phroxy.git
Log | Files | Refs | LICENSE

commit 6399fbf8c0ea8bb09ad819e86c4393845b5e1472
parent 4c0ea205738fb85c00e1dba8a8cfbe87ea614119
Author: Willy Goiffon <dev@z3bra.org>
Date:   Tue, 15 Sep 2020 18:23:20 +0200

Enfore a default hole when none given

Diffstat:
Mconfig.def.h | 1+
Mphroxy.c | 6++----
2 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/config.def.h b/config.def.h @@ -1,3 +1,4 @@ +char *default_hole = "z3bra.org"; const char *http_host = "z3bra.org"; const char *htmlfmt = "<!DOCTYPE HTML>\n" diff --git a/phroxy.c b/phroxy.c @@ -354,10 +354,8 @@ phroxy(char *url) url++; hole = strsep(&url, "/"); - if (!hole) { - printhttp(404); - return 1; - } + if (!hole || !strnlen(hole, 1)) + hole = default_hole; host = strsep(&hole, ":"); port = strsep(&hole, "\0");