diff options
author | cflip <cflip@cflip.net> | 2023-08-07 09:44:56 -0600 |
---|---|---|
committer | cflip <cflip@cflip.net> | 2023-08-07 09:44:56 -0600 |
commit | 89c62ba0739421b44c2f6d54a89011d81bf9e57c (patch) | |
tree | a87cdf1dcacf248bad5d0b2d62c507ab943e5640 /file.c | |
parent | 555f21649b909fd37a6153843249d72ca80ac427 (diff) |
The HTTP request parser has been mostly rewritten, and now it is able to
parse header lines. This makes it possible to get the cookie string from
the request and pass it to CGI scripts, which was needed for the cflip
forum to retain login status.
It is now possible to run the forum through cfws, log in and submit
threads and posts!
Diffstat (limited to 'file.c')
-rw-r--r-- | file.c | 4 |
1 files changed, 4 insertions, 0 deletions
@@ -126,6 +126,9 @@ static void cgi_setup_env(const char *filepath, const struct http_request *req) if (req->query_str) setenv("QUERY_STRING", req->query_str, 1); + if (req->cookie) + setenv("HTTP_COOKIE", req->cookie, 1); + if (req->body) { static char intbuf[20]; static char *content_type = "application/x-www-form-urlencoded"; @@ -196,6 +199,7 @@ int file_read_cgi(const char *filepath, const char *program, const struct http_r write(sockfd, buffer, bytes_read); unsetenv("QUERY_STRING"); + unsetenv("HTTP_COOKIE"); unsetenv("CONTENT"); unsetenv("CONTENT_LENGTH"); |