9ff991d907
Minor refactorings
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
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
...
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
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
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
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
Run Unit Tests / build-and-run-unit-tests (push) Successful in 2m0s
2024-10-30 15:52:27 +09:00
8d2e5f52a4
Fix test crashing if "xdg-mime" did not exist
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
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
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
...
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
Run Unit Tests / build-and-run-unit-tests (push) Successful in 20s
2024-10-29 12:46:14 +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
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
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)
...
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
a017fccc27
Fix type when setting "extra" var on string part
2024-09-25 13:28:42 +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
856c205f31
Unescape percent-encoded uri when handling request
...
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
...
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
206cad6f57
Impl. alternate delimeter creating cache-filename
Run Unit Tests / build-and-run-unit-tests (push) Successful in 8s
2024-09-23 17:42:02 +09:00
7cc0d624be
Fix use-after-free in path-to-filename function
Run Unit Tests / build-and-run-unit-tests (push) Successful in 8s
2024-09-23 15:10:39 +09:00
abc61a5504
Impl. path-to-cache-filename, fixes to strip-path
Run Unit Tests / build-and-run-unit-tests (push) Successful in 8s
2024-09-23 14:58:28 +09:00
0956ae165e
Refactor http_template to use String_Part
Run Unit Tests / build-and-run-unit-tests (push) Successful in 9s
2024-09-23 14:09:25 +09:00
f8b2f63554
Fix potential memory leak
...
Run Unit Tests / build-and-run-unit-tests (push) Successful in 8s
Fixes #5
2024-09-22 19:09:07 +09:00
8974c7b31f
Add WIP html_cache
Run Unit Tests / build-and-run-unit-tests (push) Successful in 8s
2024-09-22 15:44:04 +09:00
6f845a7185
Add helper to create string parts and combine them
2024-09-22 15:39:35 +09:00
6d5a1d1bdd
Minor fix
Run Unit Tests / build-and-run-unit-tests (push) Successful in 8s
2024-09-22 14:43:28 +09:00
ffc8e99f73
Add new arg for program: --enable-cache-dir=<DIR>
2024-09-22 14:42:41 +09:00
7a8582faac
Change template generation: output used filenames
2024-09-22 14:26:07 +09:00
1416a47e87
Use volatile for global variables
...
Run Unit Tests / build-and-run-unit-tests (push) Successful in 1m26s
These globals are accessed in signal handling, so they need to be
volatile.
Resolves #4
2024-09-21 14:41:02 +09:00
1deec0c564
Update globals to use "fast" int type
Run Unit Tests / build-and-run-unit-tests (push) Successful in 7s
2024-09-21 12:02:18 +09:00
13ccc1b3bd
Use stdint.h types instead of int, long, etc.
Run Unit Tests / build-and-run-unit-tests (push) Successful in 7s
2024-09-20 21:45:51 +09:00
47d7f0396d
Add tests for c_simple_http_strip_path(...)
Run Unit Tests / build-and-run-unit-tests (push) Successful in 1m30s
2024-09-16 12:04:21 +09:00
f15452baa4
Fix case where URL has extra trailing '/'
Run Unit Tests / build-and-run-unit-tests (push) Successful in 8s
2024-09-16 11:20:15 +09:00
371c180cc7
Minor fix
Run Unit Tests / build-and-run-unit-tests (push) Successful in 8s
2024-09-12 14:55:51 +09:00
b22556ec6f
Cleanup: removed unused pointer in internal struct
Run Unit Tests / build-and-run-unit-tests (push) Successful in 3s
2024-09-10 21:44:10 +09:00
051be910f3
Fix potential "strlen(NULL)"
Run Unit Tests / build-and-run-unit-tests (push) Successful in 38s
2024-09-10 21:18:10 +09:00
57c0812c24
Minor refactoring/fixes
Run Unit Tests / build-and-run-unit-tests (push) Successful in 38s
2024-09-10 19:22:47 +09:00
a56adb171f
Minor refactoring
Run Unit Tests / build-and-run-unit-tests (push) Successful in 39s
2024-09-10 18:01:45 +09:00
5303bbe5fd
Minor refactoring
Run Unit Tests / build-and-run-unit-tests (push) Successful in 39s
2024-09-10 15:39:16 +09:00
7fec8cc071
Make config reloading more robust
Run Unit Tests / build-and-run-unit-tests (push) Successful in 3s
2024-09-10 15:34:26 +09:00
bf7bfe5c86
Impl. hot reloading of config and on SIGUSR1
...
Run Unit Tests / build-and-run-unit-tests (push) Successful in 40s
Resolves #2
2024-09-10 13:55:16 +09:00
bc879408fe
Fix "unfixed" "count" from previous commit
Run Unit Tests / build-and-run-unit-tests (push) Successful in 2s
2024-09-09 17:01:41 +09:00
615a3e95e5
Fix typo when returning 500 error
Run Unit Tests / build-and-run-unit-tests (push) Successful in 5s
2024-09-09 16:59:46 +09:00
952808aefc
Minor fixes/cleanup
Run Unit Tests / build-and-run-unit-tests (push) Successful in 5s
2024-09-09 13:53:58 +09:00
3bace3286f
Refactor "print request headers"
...
Run Unit Tests / build-and-run-unit-tests (push) Successful in 2s
Resolves #1
2024-09-09 12:41:15 +09:00