]> git.seodisparate.com - c_simple_http/log
c_simple_http
6 months agoUpdate README.md
Stephen Seo [Thu, 26 Sep 2024 04:04:58 +0000 (13:04 +0900)]
Update README.md

6 months agoMerge branch 'dev'
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

6 months agoUpdate README.md
Stephen Seo [Thu, 26 Sep 2024 03:38:51 +0000 (12:38 +0900)]
Update README.md

6 months agoImpl. cache file lifetime checking
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.

6 months agoReload config file if cache is older than config
Stephen Seo [Thu, 26 Sep 2024 02:51:42 +0000 (11:51 +0900)]
Reload config file if cache is older than config

6 months agoSleep in test to ensure changed file timestamp
Stephen Seo [Wed, 25 Sep 2024 07:23:04 +0000 (16:23 +0900)]
Sleep in test to ensure changed file timestamp

6 months agoImpl. html cache (mostly done)
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.

6 months agobackport: Fix type set "extra" var on string part
Stephen Seo [Wed, 25 Sep 2024 04:28:42 +0000 (13:28 +0900)]
backport: Fix type set "extra" var on string part

6 months agoFix type when setting "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

6 months agobackport: StringPart's extra type to uintptr_t
Stephen Seo [Wed, 25 Sep 2024 04:14:01 +0000 (13:14 +0900)]
backport: StringPart's extra type to uintptr_t

6 months agoUpdate example config
Stephen Seo [Tue, 24 Sep 2024 05:53:28 +0000 (14:53 +0900)]
Update example config

6 months agoChange StringPart's extra type to uintptr_t
Stephen Seo [Wed, 25 Sep 2024 04:14:01 +0000 (13:14 +0900)]
Change StringPart's extra type to uintptr_t

6 months agoImpl. c_simple_http_cache_filename_to_path(...)
Stephen Seo [Wed, 25 Sep 2024 04:10:44 +0000 (13:10 +0900)]
Impl. c_simple_http_cache_filename_to_path(...)

6 months agobackport: "Connection: close" in response headers
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.

6 months agobackport: remove extra '/' in URI, config changes
Stephen Seo [Tue, 24 Sep 2024 05:53:28 +0000 (14:53 +0900)]
backport: remove extra '/' in URI, config changes

6 months agobackport: unesc. percent-encoded uri, string parts
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

6 months agoUnescape percent-encoded uri when handling request
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

6 months agoUse "Connection: close" in response headers
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.

6 months agoImpl. alternate delimeter creating cache-filename
Stephen Seo [Mon, 23 Sep 2024 08:42:02 +0000 (17:42 +0900)]
Impl. alternate delimeter creating cache-filename

6 months agoFix use-after-free in path-to-filename function
Stephen Seo [Mon, 23 Sep 2024 06:10:39 +0000 (15:10 +0900)]
Fix use-after-free in path-to-filename function

6 months agoImpl. path-to-cache-filename, fixes to strip-path
Stephen Seo [Mon, 23 Sep 2024 05:58:28 +0000 (14:58 +0900)]
Impl. path-to-cache-filename, fixes to strip-path

6 months agoRefactor http_template to use String_Part
Stephen Seo [Mon, 23 Sep 2024 05:09:25 +0000 (14:09 +0900)]
Refactor http_template to use String_Part

6 months agoFix potential memory leak
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

6 months agoAdd WIP html_cache
Stephen Seo [Sun, 22 Sep 2024 06:44:04 +0000 (15:44 +0900)]
Add WIP html_cache

6 months agoAdd helper to create string parts and combine them
Stephen Seo [Sun, 22 Sep 2024 06:39:35 +0000 (15:39 +0900)]
Add helper to create string parts and combine them

6 months agoMinor fix
Stephen Seo [Sun, 22 Sep 2024 05:43:28 +0000 (14:43 +0900)]
Minor fix

6 months agoAdd new arg for program: --enable-cache-dir=<DIR>
Stephen Seo [Sun, 22 Sep 2024 05:42:41 +0000 (14:42 +0900)]
Add new arg for program: --enable-cache-dir=<DIR>

6 months agoUpdate .gitignore
Stephen Seo [Sun, 22 Sep 2024 05:26:50 +0000 (14:26 +0900)]
Update .gitignore

6 months agoChange template generation: output used filenames
Stephen Seo [Sun, 22 Sep 2024 05:26:07 +0000 (14:26 +0900)]
Change template generation: output used filenames

7 months agoUpdate third-party submodule SimpleArchiver
Stephen Seo [Sat, 21 Sep 2024 09:46:21 +0000 (18:46 +0900)]
Update third-party submodule SimpleArchiver

7 months agoUse volatile for global variables
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

7 months agoUpdate globals to use "fast" int type
Stephen Seo [Sat, 21 Sep 2024 03:02:18 +0000 (12:02 +0900)]
Update globals to use "fast" int type

7 months agoUpdate third-party submodule SimpleArchiver
Stephen Seo [Sat, 21 Sep 2024 02:59:05 +0000 (11:59 +0900)]
Update third-party submodule SimpleArchiver

7 months agoUse stdint.h types instead of int, long, etc.
Stephen Seo [Fri, 20 Sep 2024 12:45:51 +0000 (21:45 +0900)]
Use stdint.h types instead of int, long, etc.

7 months agoUpdate third_party submodule SimpleArchiver
Stephen Seo [Fri, 20 Sep 2024 12:45:18 +0000 (21:45 +0900)]
Update third_party submodule SimpleArchiver

7 months agoAdd tests for c_simple_http_strip_path(...)
Stephen Seo [Mon, 16 Sep 2024 03:04:21 +0000 (12:04 +0900)]
Add tests for c_simple_http_strip_path(...)

7 months agoFix case where URL has extra trailing '/'
Stephen Seo [Mon, 16 Sep 2024 02:20:15 +0000 (11:20 +0900)]
Fix case where URL has extra trailing '/'

7 months agoUpdate third-party submodule SimpleArchiver
Stephen Seo [Fri, 13 Sep 2024 02:40:01 +0000 (11:40 +0900)]
Update third-party submodule SimpleArchiver

7 months agoMinor fix
Stephen Seo [Thu, 12 Sep 2024 05:55:51 +0000 (14:55 +0900)]
Minor fix

7 months agoMinor fix to Makefile
Stephen Seo [Wed, 11 Sep 2024 04:28:06 +0000 (13:28 +0900)]
Minor fix to Makefile

7 months agoCI: Run unit tests on Release build as well
Stephen Seo [Wed, 11 Sep 2024 04:18:38 +0000 (13:18 +0900)]
CI: Run unit tests on Release build as well

7 months agoUpdate Makefile
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.

7 months agoRevert "Update CMakeLists.txt"
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.

7 months agoUpdate CMakeLists.txt
Stephen Seo [Wed, 11 Sep 2024 04:01:09 +0000 (13:01 +0900)]
Update CMakeLists.txt

7 months agoUpdate CMakeLists.txt
Stephen Seo [Wed, 11 Sep 2024 03:58:29 +0000 (12:58 +0900)]
Update CMakeLists.txt

7 months agoAdd hardening compiler flags to Makefile
Stephen Seo [Wed, 11 Sep 2024 03:56:00 +0000 (12:56 +0900)]
Add hardening compiler flags to Makefile

7 months agoUpdate third-party submodule SimpleArchiver
Stephen Seo [Wed, 11 Sep 2024 03:49:01 +0000 (12:49 +0900)]
Update third-party submodule SimpleArchiver

7 months agoCleanup: removed unused pointer in internal struct
Stephen Seo [Tue, 10 Sep 2024 12:44:10 +0000 (21:44 +0900)]
Cleanup: removed unused pointer in internal struct

7 months agoFix potential "strlen(NULL)"
Stephen Seo [Tue, 10 Sep 2024 12:18:10 +0000 (21:18 +0900)]
Fix potential "strlen(NULL)"

7 months agoMinor refactoring/fixes
Stephen Seo [Tue, 10 Sep 2024 10:22:47 +0000 (19:22 +0900)]
Minor refactoring/fixes

7 months agoMinor refactoring
Stephen Seo [Tue, 10 Sep 2024 09:01:45 +0000 (18:01 +0900)]
Minor refactoring

7 months agoMinor refactoring
Stephen Seo [Tue, 10 Sep 2024 06:39:16 +0000 (15:39 +0900)]
Minor refactoring

7 months agoMake config reloading more robust
Stephen Seo [Tue, 10 Sep 2024 06:34:26 +0000 (15:34 +0900)]
Make config reloading more robust

7 months agoUpdate README.md
Stephen Seo [Tue, 10 Sep 2024 05:00:57 +0000 (14:00 +0900)]
Update README.md

7 months agoImpl. hot reloading of config and on SIGUSR1
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

7 months agoFix "unfixed" "count" from previous commit
Stephen Seo [Mon, 9 Sep 2024 08:01:41 +0000 (17:01 +0900)]
Fix "unfixed" "count" from previous commit

7 months agoFix typo when returning 500 error
Stephen Seo [Mon, 9 Sep 2024 07:59:46 +0000 (16:59 +0900)]
Fix typo when returning 500 error

7 months agoMinor fixes/cleanup
Stephen Seo [Mon, 9 Sep 2024 04:53:58 +0000 (13:53 +0900)]
Minor fixes/cleanup

7 months agoRefactor "print request headers"
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

7 months agoUpdate third-party submodule SimpleArchiver
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.

7 months agoImpl. print of specific headers arg/option
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.

7 months agoAdd flag to disable peer address printing
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.

7 months agoDebug print only in Debug builds
Stephen Seo [Fri, 6 Sep 2024 07:32:47 +0000 (16:32 +0900)]
Debug print only in Debug builds

7 months agoOnly allow protocol "HTTP/1.1"
Stephen Seo [Fri, 6 Sep 2024 06:57:46 +0000 (15:57 +0900)]
Only allow protocol "HTTP/1.1"

7 months agoAdd support for different error responses
Stephen Seo [Fri, 6 Sep 2024 06:55:21 +0000 (15:55 +0900)]
Add support for different error responses

7 months agoRemove "?" or "#" starting suffixes from path
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.

7 months agoUpdate third party submodule SimpleArchiver
Stephen Seo [Fri, 6 Sep 2024 05:30:33 +0000 (14:30 +0900)]
Update third party submodule SimpleArchiver

7 months agoupdate README.md
Stephen Seo [Fri, 6 Sep 2024 04:47:31 +0000 (13:47 +0900)]
update README.md

7 months agoFix warnings
Stephen Seo [Fri, 6 Sep 2024 04:43:25 +0000 (13:43 +0900)]
Fix warnings

7 months agoAdd CMakeLists.txt, update .gitignore
Stephen Seo [Fri, 6 Sep 2024 04:24:28 +0000 (13:24 +0900)]
Add CMakeLists.txt, update .gitignore

7 months agoUpdate README.md
Stephen Seo [Fri, 6 Sep 2024 04:16:31 +0000 (13:16 +0900)]
Update README.md

7 months agoAdd README.md, ensure listening port is printed
Stephen Seo [Fri, 6 Sep 2024 04:11:00 +0000 (13:11 +0900)]
Add README.md, ensure listening port is printed

7 months agoMinor tweaks/fixes
Stephen Seo [Fri, 6 Sep 2024 03:49:32 +0000 (12:49 +0900)]
Minor tweaks/fixes

Add example config using "_FILE" variables.

Increase limit of config value size from 256 to 1024.

7 months agoAdd more example.config stuff
Stephen Seo [Fri, 6 Sep 2024 03:42:18 +0000 (12:42 +0900)]
Add more example.config stuff

7 months agoFix invalid read when checking for "_FILE" vars
Stephen Seo [Fri, 6 Sep 2024 03:03:03 +0000 (12:03 +0900)]
Fix invalid read when checking for "_FILE" vars

7 months agoMinor tweak to listening port info output
Stephen Seo [Fri, 6 Sep 2024 02:56:52 +0000 (11:56 +0900)]
Minor tweak to listening port info output

7 months agoImpl. handling HTTP/1.1 requests
Stephen Seo [Fri, 6 Sep 2024 02:53:28 +0000 (11:53 +0900)]
Impl. handling HTTP/1.1 requests

TODO:
    Handle errors other than 404 Not Found.

7 months agoUse ${CC} and "CC ?= gcc" in Makefile
Stephen Seo [Thu, 5 Sep 2024 07:25:49 +0000 (16:25 +0900)]
Use ${CC} and "CC ?= gcc" in Makefile

7 months agoFix inconsistent http_template output size
Stephen Seo [Thu, 5 Sep 2024 07:18:28 +0000 (16:18 +0900)]
Fix inconsistent http_template output size

7 months agoAdd "output" size parameter to http_template fn
Stephen Seo [Thu, 5 Sep 2024 07:12:50 +0000 (16:12 +0900)]
Add "output" size parameter to http_template fn

7 months agoRemove temporary files created by unit test on end
Stephen Seo [Thu, 5 Sep 2024 05:07:42 +0000 (14:07 +0900)]
Remove temporary files created by unit test on end

7 months agoImpl. ".*_FILE" variables for templates
Stephen Seo [Thu, 5 Sep 2024 05:02:25 +0000 (14:02 +0900)]
Impl. ".*_FILE" variables for templates

If there exists a "{{{something_FILE}}}" (a variable ending with
"_FILE"), then the loaded variable will be treated as a filename and its
contents will be put in the html template.

7 months agoAdd action/workflow to run unit tests
Stephen Seo [Wed, 4 Sep 2024 08:51:07 +0000 (17:51 +0900)]
Add action/workflow to run unit tests

7 months agoconfig parsing: Handle when config has no endline
Stephen Seo [Wed, 4 Sep 2024 08:32:09 +0000 (17:32 +0900)]
config parsing: Handle when config has no endline

Put duplicate code into a macro/defines function.

7 months agoTest using "HTML_FILE" var, fixes
Stephen Seo [Wed, 4 Sep 2024 08:22:44 +0000 (17:22 +0900)]
Test using "HTML_FILE" var, fixes

7 months agoMinor formatting fix
Stephen Seo [Wed, 4 Sep 2024 06:33:47 +0000 (15:33 +0900)]
Minor formatting fix

7 months agoUpdate submodule third-party SimpleArchiver
Stephen Seo [Wed, 4 Sep 2024 06:32:14 +0000 (15:32 +0900)]
Update submodule third-party SimpleArchiver

7 months agoSet up tests for http_template, fixes
Stephen Seo [Wed, 4 Sep 2024 06:26:20 +0000 (15:26 +0900)]
Set up tests for http_template, fixes

7 months agoWIP untested Impl. html generation from templates
Stephen Seo [Tue, 3 Sep 2024 07:20:18 +0000 (16:20 +0900)]
WIP untested Impl. html generation from templates

7 months agoWIP some work on http req/response handling
Stephen Seo [Mon, 2 Sep 2024 04:51:10 +0000 (13:51 +0900)]
WIP some work on http req/response handling

7 months agoAdd more documentation about how src/config works
Stephen Seo [Mon, 2 Sep 2024 04:25:30 +0000 (13:25 +0900)]
Add more documentation about how src/config works

7 months agoUpdate third_party submodule SimpleArchiver
Stephen Seo [Sun, 1 Sep 2024 06:43:59 +0000 (15:43 +0900)]
Update third_party submodule SimpleArchiver

7 months agoUpdate third_party submodule SimpleArchiver
Stephen Seo [Sun, 1 Sep 2024 06:16:08 +0000 (15:16 +0900)]
Update third_party submodule SimpleArchiver

7 months agoUpdate Makefile: recompile if header has changed
Stephen Seo [Sun, 1 Sep 2024 03:36:04 +0000 (12:36 +0900)]
Update Makefile: recompile if header has changed

7 months agoUpdate documentation for config parsing
Stephen Seo [Sat, 31 Aug 2024 07:55:09 +0000 (16:55 +0900)]
Update documentation for config parsing

7 months agoMove config-related code from http.c to config.c
Stephen Seo [Sat, 31 Aug 2024 07:48:24 +0000 (16:48 +0900)]
Move config-related code from http.c to config.c

Also make config-related code more generic and improve unit tests of
config parsing.

7 months agoCleanup usage of third-party headers
Stephen Seo [Sat, 31 Aug 2024 05:43:53 +0000 (14:43 +0900)]
Cleanup usage of third-party headers

7 months agoWIP Impl. config file parsing for http templates
Stephen Seo [Fri, 30 Aug 2024 09:11:03 +0000 (18:11 +0900)]
WIP Impl. config file parsing for http templates

TODO:
    Still need to test "HTML_FILE".
    Response to HTTP request.

7 months agoWIP html template handling for http response
Stephen Seo [Fri, 30 Aug 2024 05:08:31 +0000 (14:08 +0900)]
WIP html template handling for http response

TODO:
    Test html template handling so that it works.
    Respond to http requests properly.

7 months agoAdd third_party SimpleArchiver (data structures)
Stephen Seo [Fri, 30 Aug 2024 02:58:11 +0000 (11:58 +0900)]
Add third_party SimpleArchiver (data structures)

Reusing the data structures implemented in the SimpleArchiver project.