tEnfore a default hole when none given - phroxy - Gopher to HTTP proxy
(HTM) git clone git://git.z3bra.org/phroxy.git
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) LICENSE
---
(DIR) commit 6399fbf8c0ea8bb09ad819e86c4393845b5e1472
(DIR) parent 4c0ea205738fb85c00e1dba8a8cfbe87ea614119
(HTM) Author: Willy Goiffon <dev@z3bra.org>
Date: Tue, 15 Sep 2020 18:23:20 +0200
Enfore a default hole when none given
Diffstat:
M config.def.h | 1 +
M phroxy.c | 6 ++----
2 files changed, 3 insertions(+), 4 deletions(-)
---
(DIR) diff --git a/config.def.h b/config.def.h
t@@ -1,3 +1,4 @@
+char *default_hole = "z3bra.org";
const char *http_host = "z3bra.org";
const char *htmlfmt =
"<!DOCTYPE HTML>\n"
(DIR) diff --git a/phroxy.c b/phroxy.c
t@@ -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");