Commit graph

142 commits

Author SHA1 Message Date
37e0c3a98b Remove unused parameter in function in config.c
All checks were successful
Run Unit Tests / build-and-run-unit-tests (push) Successful in 22s
2024-11-10 21:09:55 +09:00
0bbe280e1f Cleanup by separating "generate" to source files 2024-11-10 21:06:41 +09:00
faa262ba95 Check if fopen() fails during generating html
All checks were successful
Run Unit Tests / build-and-run-unit-tests (push) Successful in 21s
2024-11-10 20:47:56 +09:00
68551de565 Fix typo in impl. of --generate-dir=<DIR>
All checks were successful
Run Unit Tests / build-and-run-unit-tests (push) Successful in 21s
2024-11-10 20:45:37 +09:00
de2d15033e Impl. --generate-dir=<DIR>
All checks were successful
Run Unit Tests / build-and-run-unit-tests (push) Successful in 22s
Also added flag `--generate-enable-overwrite`.

Resolves #11
2024-11-10 20:39:49 +09:00
0d552d2cb0 Version 1.1
All checks were successful
Build for Releases / ensure-release-exists (push) Successful in 1s
Run Unit Tests / build-and-run-unit-tests (push) Successful in 20s
Build for Releases / push-build-x86_64 (push) Successful in 6s
Build for Releases / push-build-aarch64 (push) Successful in 1m8s
Build for Releases / push-build-x86_64_debian (push) Successful in 34s
Build for Releases / push-build-aarch64_debian (push) Successful in 5m9s
2024-11-08 15:20:08 +09:00
e1dde1576a Update Changelog.md
All checks were successful
Run Unit Tests / build-and-run-unit-tests (push) Successful in 19s
2024-11-08 14:37:54 +09:00
1cb593e155 Allow key/value buffers to be dynamically sized
All checks were successful
Run Unit Tests / build-and-run-unit-tests (push) Successful in 22s
Fixes #10
2024-11-08 14:32:57 +09:00
95aef64618 Refactor config.c to change c-macros to functions
All checks were successful
Run Unit Tests / build-and-run-unit-tests (push) Successful in 1m56s
Resolves #9
2024-11-08 14:00:36 +09:00
80b1d49e74 Add Changelog.md
All checks were successful
Build for Releases / ensure-release-exists (push) Successful in 0s
Build for Releases / push-build-x86_64 (push) Successful in 7s
Run Unit Tests / build-and-run-unit-tests (push) Successful in 2m2s
Build for Releases / push-build-aarch64 (push) Successful in 1m13s
Build for Releases / push-build-x86_64_debian (push) Successful in 31s
Build for Releases / push-build-aarch64_debian (push) Successful in 4m55s
2024-11-07 13:34:06 +09:00
53b3974d58 Fix invalid "closedir(...)" on NULL ptr 2024-11-07 13:30:59 +09:00
81c1123b7f Add build_releases.yaml action/workflow
All checks were successful
Build for Releases / ensure-release-exists (push) Successful in 1s
Run Unit Tests / build-and-run-unit-tests (push) Successful in 24s
Build for Releases / push-build-x86_64 (push) Successful in 8s
Build for Releases / push-build-aarch64 (push) Successful in 1m13s
Build for Releases / push-build-x86_64_debian (push) Successful in 34s
Build for Releases / push-build-aarch64_debian (push) Successful in 5m10s
2024-11-07 13:25:34 +09:00
a27930de85 Minor refactoring
All checks were successful
Run Unit Tests / build-and-run-unit-tests (push) Successful in 2m1s
Accept connections until there are no more connections to accept in a
single iteration.
2024-11-06 14:47:47 +09:00
9ff991d907 Minor refactorings
All checks were successful
Run Unit Tests / build-and-run-unit-tests (push) Successful in 20s
2024-11-04 16:25:19 +09:00
5a9cdb33c4 Fix possible double-close of connection fd
All checks were successful
Run Unit Tests / build-and-run-unit-tests (push) Successful in 2m0s
2024-11-04 15:40:25 +09:00
fef2d154ce Handle multiple connections simultaneously
All checks were successful
Run Unit Tests / build-and-run-unit-tests (push) Successful in 2m2s
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 #8 .
2024-11-04 15:25:27 +09:00
d4b3c3af8b Refactor static_validate_path
All checks were successful
Run Unit Tests / build-and-run-unit-tests (push) Successful in 19s
2024-11-03 18:20:26 +09:00
1b7c73f12f Add timeout to incoming connections
All checks were successful
Run Unit Tests / build-and-run-unit-tests (push) Successful in 20s
2024-11-03 18:11:50 +09:00
76ec53dfb0 Fix free'd buf not being set to NULL
All checks were successful
Run Unit Tests / build-and-run-unit-tests (push) Successful in 2m2s
2024-11-03 17:55:09 +09:00
a14355ac81 Fix potential invalid path when fetching static 2024-11-03 17:54:55 +09:00
c77f8cdb96 Properly handle 404 when checking static-dir
All checks were successful
Run Unit Tests / build-and-run-unit-tests (push) Successful in 2m0s
2024-10-30 15:52:27 +09:00
d999ec059e Update README.md
All checks were successful
Run Unit Tests / build-and-run-unit-tests (push) Successful in 2m0s
2024-10-30 15:41:56 +09:00
d30a074199 Move test static file to "example_static_dir/" 2024-10-30 15:41:07 +09:00
83166635d0 Update third-party submodule SimpleArchiver
All checks were successful
Run Unit Tests / build-and-run-unit-tests (push) Successful in 2m0s
2024-10-30 14:42:27 +09:00
1907469ee0 Update README.md 2024-10-30 14:42:00 +09:00
8d2e5f52a4 Fix test crashing if "xdg-mime" did not exist
All checks were successful
Run Unit Tests / build-and-run-unit-tests (push) Successful in 21s
2024-10-30 14:29:03 +09:00
67f59e1354 Add option --enable-static-dir=<DIR>, use static
Some checks failed
Run Unit Tests / build-and-run-unit-tests (push) Failing after 55s
2024-10-30 14:17:49 +09:00
fe0f87614d Update c_simple_http_get_file(...) in static.c
Add option to not fetch mime-type and default to
"application/octet-stream".
2024-10-30 13:24:36 +09:00
86bfb5aa91 Add enum for result info when getting static file
All checks were successful
Run Unit Tests / build-and-run-unit-tests (push) Successful in 20s
2024-10-29 14:56:52 +09:00
c952d1e06b Close read-pipe on xdg-mime's side in static.c
All checks were successful
Run Unit Tests / build-and-run-unit-tests (push) Successful in 20s
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.
2024-10-29 13:45:38 +09:00
574499252e Work on fetching static file and mime-type
All checks were successful
Run Unit Tests / build-and-run-unit-tests (push) Successful in 20s
2024-10-29 12:46:14 +09:00
bce64a14f1 Update README.md
All checks were successful
Run Unit Tests / build-and-run-unit-tests (push) Successful in 1m55s
2024-09-26 16:33:07 +09:00
3f1be0cf49 Update README.md
All checks were successful
Run Unit Tests / build-and-run-unit-tests (push) Successful in 33s
2024-09-26 13:04:58 +09:00
8a5195d5c4 Merge branch 'dev'
All checks were successful
Run Unit Tests / build-and-run-unit-tests (push) Successful in 20s
Resolves #3
2024-09-26 12:59:27 +09:00
aef990f341 Update README.md
All checks were successful
Run Unit Tests / build-and-run-unit-tests (push) Successful in 21s
2024-09-26 12:38:51 +09:00
700adf2f7b 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.
2024-09-26 12:37:45 +09:00
9459ec9313 Reload config file if cache is older than config
Some checks failed
Run Unit Tests / build-and-run-unit-tests (push) Failing after 6s
2024-09-26 11:51:42 +09:00
037845e501 Sleep in test to ensure changed file timestamp
All checks were successful
Run Unit Tests / build-and-run-unit-tests (push) Successful in 1m45s
2024-09-25 16:23:04 +09:00
83e4a51985 Impl. html cache (mostly done)
Some checks failed
Run Unit Tests / build-and-run-unit-tests (push) Failing after 4s
TODO: Invalidate cache if it is too old.
2024-09-25 16:12:25 +09:00
c4eff1cbaa backport: Fix type set "extra" var on string part
All checks were successful
Run Unit Tests / build-and-run-unit-tests (push) Successful in 7s
2024-09-25 13:29:13 +09:00
a017fccc27 Fix type when setting "extra" var on string part 2024-09-25 13:28:42 +09:00
8a2dd6770a backport: StringPart's extra type to uintptr_t
All checks were successful
Run Unit Tests / build-and-run-unit-tests (push) Successful in 1m29s
2024-09-25 13:18:06 +09:00
07153f3588 Update example config
All checks were successful
Run Unit Tests / build-and-run-unit-tests (push) Successful in 9s
2024-09-25 13:16:22 +09:00
4e670d24c8 Change StringPart's extra type to uintptr_t 2024-09-25 13:14:01 +09:00
b9e4e3de5f Impl. c_simple_http_cache_filename_to_path(...) 2024-09-25 13:10:44 +09:00
8eb0578454 backport: "Connection: close" in response headers
All checks were successful
Run Unit Tests / build-and-run-unit-tests (push) Successful in 9s
The current implementation always closes the connection after sending
the response, so it should notify the client to close the connection.
2024-09-24 14:57:29 +09:00
f22a523b45 backport: remove extra '/' in URI, config changes
All checks were successful
Run Unit Tests / build-and-run-unit-tests (push) Successful in 7s
2024-09-24 14:53:28 +09:00
570da15dab backport: unesc. percent-encoded uri, string parts
Resolves #6
2024-09-24 14:29:46 +09:00
856c205f31 Unescape percent-encoded uri when handling request
All checks were successful
Run Unit Tests / build-and-run-unit-tests (push) Successful in 8s
Resolves #6
2024-09-24 13:16:34 +09:00
fdaaf04600 Use "Connection: close" in response headers
All checks were successful
Run Unit Tests / build-and-run-unit-tests (push) Successful in 8s
The current implementation always closes the connection after sending
the response, so it should notify the client to close the connection.
2024-09-23 19:44:51 +09:00