commit 820448916f944175130c12b16a0cd6a6aae7b433
parent fcd78143ca4ca607af282ce6abe8b903254a9b73
Author: Quentin Rameau <quinq@fifth.space>
Date: Mon, 19 Feb 2018 15:45:34 +0100
Fix URL parsing with delimiting '/' and empty path
Diffstat:
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/sacc.c b/sacc.c
@@ -772,15 +772,17 @@ moldentry(char *url)
continue;
case '/':
*p = '\0';
- gopherpath = p+1;
parsed = 1;
continue;
}
}
- if (*host == '\0' || *port == '\0' || ipv6 || *gopherpath == '\0')
+ if (*host == '\0' || *port == '\0' || ipv6)
die("Can't parse url");
+ if (*p != '\0')
+ gopherpath = p;
+
entry = xcalloc(sizeof(Item));
entry->type = gopherpath[0];
entry->username = entry->selector = ++gopherpath;