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 500ede628d2557b8b68257484597f67f03f87e94 DIR parent 737985333a6beea0e609b139b080228b117ef9c3 URI Author: Stefan Hagen <sh+git[at]codevoid[dot]de> Date: Mon, 22 Apr 2019 13:25:52 +0200 rewrite support (lazy version) Diffstat: M gopherproxy.c | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) --- DIR diff --git a/gopherproxy.c b/gopherproxy.c t@@ -363,9 +363,15 @@ servedir(const char *server, const char *port, const char *path, const char *par if (v._type == 'h' && !strncmp(v.path, "URL:", sizeof("URL:") - 1)) { xmlencode(v.path + sizeof("URL:") - 1); } else { - fputs("?q=", stdout); - if(strncmp(uri, "/", sizeof("/") -1)) + if(enable_rewrite == 0) { + fputs("?q=", stdout); + } + if(strncmp(uri, "/", sizeof("/") -1)) { + if(enable_rewrite == 1) { + fputs("/?q=", stdout); + } fputs("gopher://", stdout); + } xmlencode(uri); } fputs("\">", stdout); t@@ -602,10 +608,11 @@ main(void) "<html dir=\"ltr\">\n" "<head>\n" "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\" />\n" - "<title>gopher://codevoid.de", stdout); - //if (query[0]) - // fputs(" - ", stdout); - xmlencode(query); + "<title>", stdout); + fputs("gopher://codevoid.de", stdout); + if (strrchr(path, '/')) { + xmlencode(query); + } fputs( "</title>\n" "<style type=\"text/css\">a { text-decoration: none; } "