feat: add stream data patching with find-replace and content blocking for HTTP routes

Implement configurable patch rules for rewriting or blocking textual content in HTTP streams. New `patch` configuration object supports string replacement and content blocking via null values, applied bidirectionally to requests and responses. Blocked responses return 502, blocked requests return 403.
This commit is contained in:
2025-11-29 04:56:34 +00:00
parent eeb9544b83
commit 4c17705239
9 changed files with 504 additions and 9 deletions
+5
View File
@@ -18,6 +18,7 @@ SOURCES = $(SRC_DIR)/main.c \
$(SRC_DIR)/rate_limit.c \
$(SRC_DIR)/auth.c \
$(SRC_DIR)/health_check.c \
$(SRC_DIR)/patch.c \
cJSON.c
OBJECTS = $(patsubst %.c,$(BUILD_DIR)/%.o,$(notdir $(SOURCES)))
@@ -43,6 +44,7 @@ TEST_LIB_SOURCES = $(SRC_DIR)/buffer.c \
$(SRC_DIR)/rate_limit.c \
$(SRC_DIR)/auth.c \
$(SRC_DIR)/health_check.c \
$(SRC_DIR)/patch.c \
cJSON.c
TEST_LIB_OBJECTS = $(patsubst %.c,$(BUILD_DIR)/%.o,$(notdir $(TEST_LIB_SOURCES)))
@@ -95,6 +97,9 @@ $(BUILD_DIR)/auth.o: $(SRC_DIR)/auth.c
$(BUILD_DIR)/health_check.o: $(SRC_DIR)/health_check.c
$(CC) $(CFLAGS) -c $< -o $@
$(BUILD_DIR)/patch.o: $(SRC_DIR)/patch.c
$(CC) $(CFLAGS) -c $< -o $@
$(BUILD_DIR)/cJSON.o: cJSON.c
$(CC) $(CFLAGS) -c $< -o $@