print a message if a protocol is not supported - gopherproxy-c - Gopher HTTP pr… | |
git clone git://git.codemadness.org/gopherproxy-c | |
Log | |
Files | |
Refs | |
README | |
LICENSE | |
--- | |
commit 78efc56f91b0956fe6e2dcc7919a4dcd64dfe66a | |
parent b4fcf2516500e0d3979721cae7d91f430e72fa41 | |
Author: Hiltjo Posthuma <[email protected]> | |
Date: Mon, 16 May 2022 14:46:40 +0200 | |
print a message if a protocol is not supported | |
This would not trigger because URIs are prefixed with gopher:// otherwise. | |
Reported by parazyd by testing gophers:// which is not supported (yet). | |
Diffstat: | |
M gopherproxy.c | 3 +++ | |
1 file changed, 3 insertions(+), 0 deletions(-) | |
--- | |
diff --git a/gopherproxy.c b/gopherproxy.c | |
@@ -611,6 +611,8 @@ main(void) | |
r = snprintf(fulluri, sizeof(fulluri), "%s", query); | |
} else { | |
showuri = query; | |
+ if (uri_hasscheme(query)) | |
+ die(400, "Invalid protocol: only gopher is sup… | |
r = snprintf(fulluri, sizeof(fulluri), "gopher://%s", … | |
} | |
if (r < 0 || (size_t)r >= sizeof(fulluri)) | |
@@ -619,6 +621,7 @@ main(void) | |
if (!uri_hasscheme(fulluri) || | |
uri_parse(fulluri, &u) == -1) | |
die(400, "Invalid or unsupported URI: %s\n", showuri); | |
+ | |
if (strcmp(u.proto, "gopher://")) | |
die(400, "Invalid protocol: only gopher is supported\n… | |
if (u.host[0] == '\0') |