Make compatibility serving a full feature. - geomyidae - a small C-based gopher… | |
git clone git://git.codemadness.org/geomyidae | |
Log | |
Files | |
Refs | |
README | |
LICENSE | |
--- | |
commit 81f3ec7d02246ab56d7fcc57ce18d546a3fe4b6f | |
parent 6dc65c6ce9c4a41c034aa1f21d9ff2a1573efde4 | |
Author: Christoph Lohmann <[email protected]> | |
Date: Sat, 22 Jul 2023 17:27:20 +0200 | |
Make compatibility serving a full feature. | |
Diffstat: | |
M main.c | 13 +++++++++---- | |
1 file changed, 9 insertions(+), 4 deletions(-) | |
--- | |
diff --git a/main.c b/main.c | |
@@ -187,19 +187,24 @@ handlerequest(int sock, char *req, int rlen, char *base, … | |
if (c) | |
c[0] = '\0'; | |
+ memmove(recvc, recvb, rlen+1); | |
/* | |
* Try to guess if we have some HTTP-like protocol compatibility | |
* mode. | |
*/ | |
if (!nocgi && recvb[0] != '/' && (c = strchr(recvb, ' '))) { | |
- *c = '\0'; | |
+ *c++ = '\0'; | |
if (strchr(recvb, '/')) | |
goto dothegopher; | |
if (snprintf(path, sizeof(path), "%s/%s", base, recvb) <= size… | |
if (realpath(path, (char *)rpath)) { | |
- if (stat(rpath, &dir)) { | |
- handlecgi(sock, rpath, port, base, NUL… | |
- clienth, serverh, istls, req, … | |
+ if (stat(rpath, &dir) == 0) { | |
+ if (loglvl & FILES) | |
+ logentry(clienth, clientp, rec… | |
+ | |
+ handlecgi(sock, rpath, port, base, "",… | |
+ clienth, serverh, istls, req, … | |
+ return; | |
} | |
} | |
} |