t* gopherproxy-c customized URI git clone git://git.codevoid.de/gopherproxy-c-sdk DIR Log DIR Files DIR Refs DIR README DIR LICENSE --- DIR commit 31bf0e0fa53e34bf32a57257f6e306a67ea813a6 DIR parent ab450f6020e7a69eaba6446167ba25b9d296a5d9 URI Author: Hiltjo Posthuma <hiltjo@codemadness.org> Date: Tue, 21 Aug 2018 17:43:52 +0200 improve uri parsing according to the RFC spec tthe path doesn't have to start with / Diffstat: M gopherproxy.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) --- DIR diff --git a/gopherproxy.c b/gopherproxy.c t@@ -134,8 +134,6 @@ isblacklisted(const char *host, const char *port, const char *path) { char *p; - if (path[0] != '/') - return 1; if (strcmp(port, "70") && strcmp(port, "7070")) return 1; if ((p = strstr(host, ".onion")) && strlen(p) == strlen(".onion")) t@@ -530,12 +528,13 @@ main(void) path = u.path; if (path[0] == '/') { - if (path[1]) { - _type = path[1]; - path += 2; + path++; + if (*path) { + _type = *path; + path++; } } else { - path = "/"; + path = ""; } if (isblacklisted(u.host, u.port, path))