| First stub for new http-compatibility feature. - geomyidae - A small C-based go… | |
| git clone git://bitreich.org/geomyidae/ git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfri… | |
| Log | |
| Files | |
| Refs | |
| Tags | |
| README | |
| LICENSE | |
| --- | |
| commit 3a876cbe4fb9b93ecf98decfa79e7f9b27dbc320 | |
| parent 646c0c9ac1c8944393c3640c63ffefd6f400c2a5 | |
| Author: Christoph Lohmann <[email protected]> | |
| Date: Sat, 22 Jul 2023 17:14:59 +0200 | |
| First stub for new http-compatibility feature. | |
| Diffstat: | |
| M main.c | 19 +++++++++++++++++++ | |
| 1 file changed, 19 insertions(+), 0 deletions(-) | |
| --- | |
| diff --git a/main.c b/main.c | |
| @@ -187,6 +187,25 @@ handlerequest(int sock, char *req, int rlen, char *base, c… | |
| if (c) | |
| c[0] = '\0'; | |
| + /* | |
| + * Try to guess if we have some HTTP-like protocol compatibility | |
| + * mode. | |
| + */ | |
| + if (!nocgi && recvb[0] != '/' && (c = strchr(recvb, " "))) { | |
| + *c = '\0'; | |
| + if (strchr(recvb, '/')) | |
| + goto dothegopher; | |
| + if (snprintf(path, "%s/%s", base, recvb) <= sizeof(path)) { | |
| + if (realpath(path, (char *)rpath)) { | |
| + if (stat(rpath, &dir)) { | |
| + handlecgi(sock, rpath, port, base, NUL… | |
| + clienth, serverh, istls, req, … | |
| + } | |
| + } | |
| + } | |
| + } | |
| +dothegopher: | |
| + | |
| /* Do not allow requests including "..". */ | |
| if (strstr(recvb, "..")) { | |
| dprintf(sock, "%s", selinval); |