summaryrefslogtreecommitdiff
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-07-14Add verbose flag and command line help messagecflip
2023-07-09Gracefully shut down server when interrupted with Ctrl+Ccflip
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-08Parse HTTP POST requests and request bodycflip
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-06Ignore SIGPIPE signals when writing to a closed socketcflip
2023-06-03Respond with 501 Not Implemented for unknown request methodscflip
2023-06-01Remove extra test filescflip
2023-06-01Remove ClangFormat and ClangTidy filescflip
These were leftovers from the C++ version of this project. It might still be nice to have a formatter and static analyzer, but the configurations in those files didn't work well with the new C port.
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-06-01Parse query string from HTTP requestscflip
2023-05-30Move request handling code out of net.c and into the main filecflip
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-29Don't force C'89 standardcflip
There are a bunch of helpful standard library functions that I am missing out on (most notably popen)
2023-05-27Split cfws.c into multiple filescflip
2023-05-27Add Vim tags and swap files to .gitignorecflip
2023-05-27Build with debug symbols enabledcflip
2023-05-27Load and serve files from the filesystemcflip
2023-05-08Begin rewriting cfws in Ccflip
2022-09-30Respond with a different content type depending on file extensioncflip
2022-09-22Add install target to Makefilecflip
2022-09-20Validate CGI script paths before starting up the servercflip
This still doesn't throw up an error when attepting to run scripts without the leading './', but it's a start
2022-09-19Add a simple Perl script that prints out all environment varaiablescflip
This can be used to view the values of environment variables passed to CGI scripts.
2022-09-19Add ClangTidy configuration and apply fixescflip
2022-09-19Add ClangFormat configuration and reformat filescflip
2022-09-19Improve Makefile build systemcflip
Building each source file as a separate object makes it faster to compile when only changing one source file, and also allows you to compile with multiple threads when building the whole project.
2022-09-19Implement the PATH_INFO and QUERY_STRING CGI environment variablescflip
This allows scripts to differentiate between the requested path and the query parameters.
2022-09-19Refactor the CGIScript class a bitcflip
This allows the user of the class to set environment variables before opening the pipe to the script.
2022-09-19Add abstractions to automatically unset environment variablescflip
The PATH_INFO environment variable has also been added.
2022-09-17Set SO_REUSEADDR and SO_REUSEPORT socket optionscflip
This allows the server to reuse the same address and port when repeatedly running and stopping the server while testing things instead of quitting with the "Address already in use" error.
2022-09-17Call them CGI scripts instead of executablescflip
2022-09-17Make a nice wrapper class for running CGI scriptscflip
2022-09-17Set a few environment variables for CGI scriptscflip
2022-09-17Pass HTTP headers from CGI output into our HttpResponse classcflip
2022-09-15Add an option to serve CGI exectuablescflip
2022-09-15Add HTTP 500 Internal Server Errorcflip
2022-09-15Add simple argument parsing for specifying port numbercflip
2022-09-15Start serving files from the filesystemcflip
2022-09-14Fix a few compiler-dependent errorscflip
2022-07-07Implement simple URI parsing for multiple pagescflip
2022-07-07Don't print HTTP requests to the consolecflip
2022-07-07Ignore Visual Studio Code filescflip
2022-07-07Reply with a different message and response code depending on languagecflip