summaryrefslogtreecommitdiff
path: root/file.c
AgeCommit message (Collapse)Author
2023-08-07Improve HTTP request parsing and pass cookies to CGI scriptsHEADmastercflip
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!
2023-07-14Run executable files as CGI scriptscflip
Now if the server encounters an executable file that doesn't have a .php extension, it will run it as a CGI script. There should maybe be better heuristics for determining whether a file actually is a CGI script (sometimes files copied from Windows can be marked as executable) but this works for now.
2023-06-08Check file extension for NULLcflip
2023-06-08Support multiple index file names (such as index.php)cflip
2023-06-08Support POST requests for PHP scriptscflip
This makes it possible to both read from and write to the standard I/O in php-cgi so that the request body can be written to its stdin and the script can access POST request data. Unfortunately, this isn't quite enough for the user login on the cflip forum to work, since cookies (and other HTTP headers) aren't passed to the script yet.
2023-06-08Unset QUERY_STRING environment variable after running CGI scriptcflip
This prevents an issue where the previous query string would persist on requests without a query string.
2023-06-01Send the proper MIME type when serving static filesc-rewritecflip
2023-06-01Allow query strings to be read by PHP scriptscflip
php-cgi is now run without any command line arguments and information such as the script filename and the query string are passed in via environment variables.
2023-05-30Reads from files or pipes into a buffer instead of char-by-charcflip
This makes it possible to load image files, and doesn't spam write() as much.
2023-05-30Refactor response building codecflip
This new strategy involves finding the local file path for the given URI, determining what method to use to fulfill the request (read file from disk, use php-cgi, or error), then it writes the response to the client socket.
2023-05-29Hacks to make it possible to serve PHP pagescflip
The most significant change is that the functions for reading a file and such write directly to the socket instead of attempting to fill buffers.
2023-05-27Split cfws.c into multiple filescflip