tReturn 404 when host cannot be extracted - phroxy - Gopher to HTTP proxy
 (HTM) git clone git://git.z3bra.org/phroxy.git
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) LICENSE
       ---
 (DIR) commit 65b08e3fe1928eb217aa59c7f936d13b9a6a5031
 (DIR) parent fe4f5657743a30daa28fe32376c1158b0b0240d3
 (HTM) Author: Willy Goiffon <dev@z3bra.org>
       Date:   Mon, 14 Sep 2020 15:54:23 +0200
       
       Return 404 when host cannot be extracted
       
       Diffstat:
         M phroxy.c                            |       8 +++++++-
       
       1 file changed, 7 insertions(+), 1 deletion(-)
       ---
 (DIR) diff --git a/phroxy.c b/phroxy.c
       t@@ -343,7 +343,8 @@ phroxy(char *url)
        {
                int sock;
                size_t len;
       -        char item, *hole, *path, *host, *port;
       +        char item = 0;
       +        char *hole, *path, *host, *port;
                char *data = NULL;
        
                hole = url + 1;
       t@@ -356,6 +357,11 @@ phroxy(char *url)
                if (!port)
                        port = "70";
        
       +        if (!hole || !item) {
       +                print404();
       +                return 1;
       +        }
       +
                sock = connectto(host, port);
                if (!sendselector(sock, path))
                        data = getrawitem(sock, &len);