]>
git.seodisparate.com - c_simple_http/log
Stephen Seo [Sun, 10 Nov 2024 12:06:41 +0000 (21:06 +0900)]
Cleanup by separating "generate" to source files
Stephen Seo [Sun, 10 Nov 2024 11:47:56 +0000 (20:47 +0900)]
Check if fopen() fails during generating html
Stephen Seo [Sun, 10 Nov 2024 11:45:37 +0000 (20:45 +0900)]
Fix typo in impl. of `--generate-dir=<DIR>`
Stephen Seo [Sun, 10 Nov 2024 11:39:49 +0000 (20:39 +0900)]
Impl. `--generate-dir=<DIR>`
Also added flag `--generate-enable-overwrite`.
Resolves https://git.seodisparate.com/stephenseo/c_simple_http/issues/11
Stephen Seo [Fri, 8 Nov 2024 06:20:08 +0000 (15:20 +0900)]
Version 1.1
Stephen Seo [Fri, 8 Nov 2024 05:37:54 +0000 (14:37 +0900)]
Update Changelog.md
Stephen Seo [Fri, 8 Nov 2024 05:32:57 +0000 (14:32 +0900)]
Allow key/value buffers to be dynamically sized
Fixes https://git.seodisparate.com/stephenseo/c_simple_http/issues/10
Stephen Seo [Fri, 8 Nov 2024 05:00:36 +0000 (14:00 +0900)]
Refactor config.c to change c-macros to functions
Resolves https://git.seodisparate.com/stephenseo/c_simple_http/issues/9
Stephen Seo [Thu, 7 Nov 2024 04:34:06 +0000 (13:34 +0900)]
Add Changelog.md
Stephen Seo [Thu, 7 Nov 2024 04:30:59 +0000 (13:30 +0900)]
Fix invalid "closedir(...)" on NULL ptr
Stephen Seo [Thu, 7 Nov 2024 04:25:34 +0000 (13:25 +0900)]
Add build_releases.yaml action/workflow
Stephen Seo [Wed, 6 Nov 2024 05:47:47 +0000 (14:47 +0900)]
Minor refactoring
Accept connections until there are no more connections to accept in a
single iteration.
Stephen Seo [Mon, 4 Nov 2024 07:25:19 +0000 (16:25 +0900)]
Minor refactorings
Stephen Seo [Mon, 4 Nov 2024 06:40:25 +0000 (15:40 +0900)]
Fix possible double-close of connection fd
Stephen Seo [Mon, 4 Nov 2024 06:22:58 +0000 (15:22 +0900)]
Handle multiple connections simultaneously
This commit changes the implementationt to store connected clients
file-descriptors and to iterate through them all periodically to handle
requests and to time-out stale connections. This means that even if one
connection is in progress, the program can still handle new connections
from other clients.
Note this does this not by threads but by taking advantage of
non-blocking io to handle each connection.
Fixes https://git.seodisparate.com/stephenseo/c_simple_http/issues/8 .
Stephen Seo [Sun, 3 Nov 2024 09:20:26 +0000 (18:20 +0900)]
Refactor static_validate_path
Stephen Seo [Sun, 3 Nov 2024 09:11:50 +0000 (18:11 +0900)]
Add timeout to incoming connections
Stephen Seo [Sun, 3 Nov 2024 08:55:09 +0000 (17:55 +0900)]
Fix free'd buf not being set to NULL
Stephen Seo [Sun, 3 Nov 2024 08:54:55 +0000 (17:54 +0900)]
Fix potential invalid path when fetching static
Stephen Seo [Wed, 30 Oct 2024 06:52:27 +0000 (15:52 +0900)]
Properly handle 404 when checking static-dir
Stephen Seo [Wed, 30 Oct 2024 06:41:56 +0000 (15:41 +0900)]
Update README.md
Stephen Seo [Wed, 30 Oct 2024 06:41:07 +0000 (15:41 +0900)]
Move test static file to "example_static_dir/"
Stephen Seo [Wed, 30 Oct 2024 05:42:27 +0000 (14:42 +0900)]
Update third-party submodule SimpleArchiver
Stephen Seo [Wed, 30 Oct 2024 05:42:00 +0000 (14:42 +0900)]
Update README.md
Stephen Seo [Wed, 30 Oct 2024 05:29:03 +0000 (14:29 +0900)]
Fix test crashing if "xdg-mime" did not exist
Stephen Seo [Wed, 30 Oct 2024 05:17:49 +0000 (14:17 +0900)]
Add option --enable-static-dir=<DIR>, use static
Stephen Seo [Wed, 30 Oct 2024 04:24:36 +0000 (13:24 +0900)]
Update c_simple_http_get_file(...) in static.c
Add option to not fetch mime-type and default to
"application/octet-stream".
Stephen Seo [Tue, 29 Oct 2024 05:56:52 +0000 (14:56 +0900)]
Add enum for result info when getting static file
Stephen Seo [Tue, 29 Oct 2024 04:45:38 +0000 (13:45 +0900)]
Close read-pipe on xdg-mime's side in static.c
The pipe probably doesn't need to be closed since it is closed by
c_simple_http and the forked process stops while it is the only other
thing with that read-pipe-fd. However, it probably would be best to
close it so that during runtime all pipe fd's are closed after use.
Stephen Seo [Tue, 29 Oct 2024 03:42:24 +0000 (12:42 +0900)]
Work on fetching static file and mime-type
Stephen Seo [Thu, 26 Sep 2024 07:33:07 +0000 (16:33 +0900)]
Update README.md
Stephen Seo [Thu, 26 Sep 2024 04:04:58 +0000 (13:04 +0900)]
Update README.md
Stephen Seo [Thu, 26 Sep 2024 03:59:27 +0000 (12:59 +0900)]
Merge branch 'dev'
Resolves https://git.seodisparate.com/stephenseo/c_simple_http/issues/3
Stephen Seo [Thu, 26 Sep 2024 03:38:51 +0000 (12:38 +0900)]
Update README.md
Stephen Seo [Thu, 26 Sep 2024 03:37:45 +0000 (12:37 +0900)]
Impl. cache file lifetime checking
By default cache files are invalidated when the are aged for longer than
1 week. This "timeout-time" can be modified with a paramter/argument.
Stephen Seo [Thu, 26 Sep 2024 02:51:42 +0000 (11:51 +0900)]
Reload config file if cache is older than config
Stephen Seo [Wed, 25 Sep 2024 07:23:04 +0000 (16:23 +0900)]
Sleep in test to ensure changed file timestamp
Stephen Seo [Wed, 25 Sep 2024 07:12:25 +0000 (16:12 +0900)]
Impl. html cache (mostly done)
TODO: Invalidate cache if it is too old.
Stephen Seo [Wed, 25 Sep 2024 04:28:42 +0000 (13:28 +0900)]
backport: Fix type set "extra" var on string part
Stephen Seo [Wed, 25 Sep 2024 04:28:42 +0000 (13:28 +0900)]
Fix type when setting "extra" var on string part
Stephen Seo [Wed, 25 Sep 2024 04:14:01 +0000 (13:14 +0900)]
backport: StringPart's extra type to uintptr_t
Stephen Seo [Tue, 24 Sep 2024 05:53:28 +0000 (14:53 +0900)]
Update example config
Stephen Seo [Wed, 25 Sep 2024 04:14:01 +0000 (13:14 +0900)]
Change StringPart's extra type to uintptr_t
Stephen Seo [Wed, 25 Sep 2024 04:10:44 +0000 (13:10 +0900)]
Impl. c_simple_http_cache_filename_to_path(...)
Stephen Seo [Mon, 23 Sep 2024 10:44:51 +0000 (19:44 +0900)]
backport: "Connection: close" in response headers
The current implementation always closes the connection after sending
the response, so it should notify the client to close the connection.
Stephen Seo [Tue, 24 Sep 2024 05:53:28 +0000 (14:53 +0900)]
backport: remove extra '/' in URI, config changes
Stephen Seo [Tue, 24 Sep 2024 04:16:34 +0000 (13:16 +0900)]
backport: unesc. percent-encoded uri, string parts
Resolves https://git.seodisparate.com/stephenseo/c_simple_http/issues/6
Stephen Seo [Tue, 24 Sep 2024 04:16:34 +0000 (13:16 +0900)]
Unescape percent-encoded uri when handling request
Resolves https://git.seodisparate.com/stephenseo/c_simple_http/issues/6
Stephen Seo [Mon, 23 Sep 2024 10:44:51 +0000 (19:44 +0900)]
Use "Connection: close" in response headers
The current implementation always closes the connection after sending
the response, so it should notify the client to close the connection.
Stephen Seo [Mon, 23 Sep 2024 08:42:02 +0000 (17:42 +0900)]
Impl. alternate delimeter creating cache-filename
Stephen Seo [Mon, 23 Sep 2024 06:10:39 +0000 (15:10 +0900)]
Fix use-after-free in path-to-filename function
Stephen Seo [Mon, 23 Sep 2024 05:58:28 +0000 (14:58 +0900)]
Impl. path-to-cache-filename, fixes to strip-path
Stephen Seo [Mon, 23 Sep 2024 05:09:25 +0000 (14:09 +0900)]
Refactor http_template to use String_Part
Stephen Seo [Sun, 22 Sep 2024 10:09:07 +0000 (19:09 +0900)]
Fix potential memory leak
Fixes https://git.seodisparate.com/stephenseo/c_simple_http/issues/5
Stephen Seo [Sun, 22 Sep 2024 06:44:04 +0000 (15:44 +0900)]
Add WIP html_cache
Stephen Seo [Sun, 22 Sep 2024 06:39:35 +0000 (15:39 +0900)]
Add helper to create string parts and combine them
Stephen Seo [Sun, 22 Sep 2024 05:43:28 +0000 (14:43 +0900)]
Minor fix
Stephen Seo [Sun, 22 Sep 2024 05:42:41 +0000 (14:42 +0900)]
Add new arg for program: --enable-cache-dir=<DIR>
Stephen Seo [Sun, 22 Sep 2024 05:26:50 +0000 (14:26 +0900)]
Update .gitignore
Stephen Seo [Sun, 22 Sep 2024 05:26:07 +0000 (14:26 +0900)]
Change template generation: output used filenames
Stephen Seo [Sat, 21 Sep 2024 09:46:21 +0000 (18:46 +0900)]
Update third-party submodule SimpleArchiver
Stephen Seo [Sat, 21 Sep 2024 05:41:02 +0000 (14:41 +0900)]
Use volatile for global variables
These globals are accessed in signal handling, so they need to be
volatile.
Resolves https://git.seodisparate.com/stephenseo/c_simple_http/issues/4
Stephen Seo [Sat, 21 Sep 2024 03:02:18 +0000 (12:02 +0900)]
Update globals to use "fast" int type
Stephen Seo [Sat, 21 Sep 2024 02:59:05 +0000 (11:59 +0900)]
Update third-party submodule SimpleArchiver
Stephen Seo [Fri, 20 Sep 2024 12:45:51 +0000 (21:45 +0900)]
Use stdint.h types instead of int, long, etc.
Stephen Seo [Fri, 20 Sep 2024 12:45:18 +0000 (21:45 +0900)]
Update third_party submodule SimpleArchiver
Stephen Seo [Mon, 16 Sep 2024 03:04:21 +0000 (12:04 +0900)]
Add tests for c_simple_http_strip_path(...)
Stephen Seo [Mon, 16 Sep 2024 02:20:15 +0000 (11:20 +0900)]
Fix case where URL has extra trailing '/'
Stephen Seo [Fri, 13 Sep 2024 02:40:01 +0000 (11:40 +0900)]
Update third-party submodule SimpleArchiver
Stephen Seo [Thu, 12 Sep 2024 05:55:51 +0000 (14:55 +0900)]
Minor fix
Stephen Seo [Wed, 11 Sep 2024 04:28:06 +0000 (13:28 +0900)]
Minor fix to Makefile
Stephen Seo [Wed, 11 Sep 2024 04:18:38 +0000 (13:18 +0900)]
CI: Run unit tests on Release build as well
Stephen Seo [Wed, 11 Sep 2024 04:11:55 +0000 (13:11 +0900)]
Update Makefile
Some cleanup.
Use certain build flags only in "RELEASE" mode.
Stephen Seo [Wed, 11 Sep 2024 04:03:09 +0000 (13:03 +0900)]
Revert "Update CMakeLists.txt"
This reverts commit
4aa338c9c3b75de810c5f2c28c0e797e3f2c1327 .
The compiler flags added by this commit was already handled.
Stephen Seo [Wed, 11 Sep 2024 04:01:09 +0000 (13:01 +0900)]
Update CMakeLists.txt
Stephen Seo [Wed, 11 Sep 2024 03:58:29 +0000 (12:58 +0900)]
Update CMakeLists.txt
Stephen Seo [Wed, 11 Sep 2024 03:56:00 +0000 (12:56 +0900)]
Add hardening compiler flags to Makefile
Stephen Seo [Wed, 11 Sep 2024 03:49:01 +0000 (12:49 +0900)]
Update third-party submodule SimpleArchiver
Stephen Seo [Tue, 10 Sep 2024 12:44:10 +0000 (21:44 +0900)]
Cleanup: removed unused pointer in internal struct
Stephen Seo [Tue, 10 Sep 2024 12:18:10 +0000 (21:18 +0900)]
Fix potential "strlen(NULL)"
Stephen Seo [Tue, 10 Sep 2024 10:22:47 +0000 (19:22 +0900)]
Minor refactoring/fixes
Stephen Seo [Tue, 10 Sep 2024 09:01:45 +0000 (18:01 +0900)]
Minor refactoring
Stephen Seo [Tue, 10 Sep 2024 06:39:16 +0000 (15:39 +0900)]
Minor refactoring
Stephen Seo [Tue, 10 Sep 2024 06:34:26 +0000 (15:34 +0900)]
Make config reloading more robust
Stephen Seo [Tue, 10 Sep 2024 05:00:57 +0000 (14:00 +0900)]
Update README.md
Stephen Seo [Tue, 10 Sep 2024 04:55:16 +0000 (13:55 +0900)]
Impl. hot reloading of config and on SIGUSR1
Resolves https://git.seodisparate.com/stephenseo/c_simple_http/issues/2
Stephen Seo [Mon, 9 Sep 2024 08:01:41 +0000 (17:01 +0900)]
Fix "unfixed" "count" from previous commit
Stephen Seo [Mon, 9 Sep 2024 07:59:46 +0000 (16:59 +0900)]
Fix typo when returning 500 error
Stephen Seo [Mon, 9 Sep 2024 04:53:58 +0000 (13:53 +0900)]
Minor fixes/cleanup
Stephen Seo [Mon, 9 Sep 2024 03:39:47 +0000 (12:39 +0900)]
Refactor "print request headers"
Resolves https://git.seodisparate.com/stephenseo/c_simple_http/issues/1
Stephen Seo [Mon, 9 Sep 2024 02:32:05 +0000 (11:32 +0900)]
Update third-party submodule SimpleArchiver
Also fixes related to the updated third-party submodule.
Stephen Seo [Fri, 6 Sep 2024 08:30:37 +0000 (17:30 +0900)]
Impl. print of specific headers arg/option
TODO: Maybe refactor this to use a hash-map or something similar to
speed up the process. If N = number-of-headers-to-print and M =
size-of-request-buffer, then currrently this will take O(N*M) time.
Stephen Seo [Fri, 6 Sep 2024 07:40:36 +0000 (16:40 +0900)]
Add flag to disable peer address printing
Minor teak in main to make Args const.
Stephen Seo [Fri, 6 Sep 2024 07:32:47 +0000 (16:32 +0900)]
Debug print only in Debug builds
Stephen Seo [Fri, 6 Sep 2024 06:57:46 +0000 (15:57 +0900)]
Only allow protocol "HTTP/1.1"
Stephen Seo [Fri, 6 Sep 2024 06:55:21 +0000 (15:55 +0900)]
Add support for different error responses
Stephen Seo [Fri, 6 Sep 2024 06:33:31 +0000 (15:33 +0900)]
Remove "?" or "#" starting suffixes from path
These suffixes may break loading the correct html template.
Stephen Seo [Fri, 6 Sep 2024 05:30:33 +0000 (14:30 +0900)]
Update third party submodule SimpleArchiver
Stephen Seo [Fri, 6 Sep 2024 04:47:31 +0000 (13:47 +0900)]
update README.md
Stephen Seo [Fri, 6 Sep 2024 04:43:25 +0000 (13:43 +0900)]
Fix warnings