improve uri parsing according to the RFC spec - gopherproxy-c - Gopher HTTP pro… | |
git clone git://git.codemadness.org/gopherproxy-c | |
Log | |
Files | |
Refs | |
README | |
LICENSE | |
--- | |
commit 31bf0e0fa53e34bf32a57257f6e306a67ea813a6 | |
parent ab450f6020e7a69eaba6446167ba25b9d296a5d9 | |
Author: Hiltjo Posthuma <[email protected]> | |
Date: Tue, 21 Aug 2018 17:43:52 +0200 | |
improve uri parsing according to the RFC spec | |
the path doesn't have to start with / | |
Diffstat: | |
M gopherproxy.c | 11 +++++------ | |
1 file changed, 5 insertions(+), 6 deletions(-) | |
--- | |
diff --git a/gopherproxy.c b/gopherproxy.c | |
@@ -134,8 +134,6 @@ isblacklisted(const char *host, const char *port, const cha… | |
{ | |
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")) | |
@@ -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)) |