Add comment about special cases in request handling. - geomyidae - A small C-based gopherd.
(HTM) git clone git://bitreich.org/geomyidae/ git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws65d7roiv6bfj7d652fid.onion/geomyidae/
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) Tags
(DIR) README
(DIR) LICENSE
---
(DIR) commit 6c9e39e916f752250680a56bc2dad229c040af7a
(DIR) parent 2f292620fba218aa4d57117dadd4182799f25460
(HTM) Author: Christoph Lohmann <20h@r-36.net>
Date: Sun, 26 Apr 2020 12:23:19 +0200
Add comment about special cases in request handling.
Diffstat:
M main.c | 12 ++++++++++++
1 file changed, 12 insertions(+), 0 deletions(-)
---
(DIR) diff --git a/main.c b/main.c
@@ -189,6 +189,18 @@ handlerequest(int sock, char *base, char *ohost, char *port, char *clienth,
return;
}
+ /*
+ * Valid cases in gopher we overwrite here, but could be used for
+ * other geomyidae features:
+ *
+ * request string = "?..." -> "/?..."
+ * request string = "" -> "/"
+ * request string = "somestring" -> "/somestring"
+ *
+ * Be careful, when you consider those special cases to be used
+ * for some feature. You can easily do good and bad.
+ */
+
args = strchr(recvb, '?');
if (args != NULL)
*args++ = '\0';