]> Git repositories of Nishi - tewi.git/commitdiff
use dll for windows build
authorNishi <nishi@nishi.boats>
Tue, 17 Sep 2024 12:31:08 +0000 (12:31 +0000)
committerNishi <nishi@nishi.boats>
Tue, 17 Sep 2024 12:31:08 +0000 (12:31 +0000)
git-svn-id: file:///raid/svn-personal/tewi/trunk@40 8739d7e6-ffea-ec47-b151-bdff447c6205

Module/Makefile
Module/mod_cgi.c
Module/mod_example.c
Platform/generic.mk
Platform/linux.mk
Platform/win64.mk
example.conf

index fcf8c4b4af989bcfe60aa0730ae2ab81c4ae9e80..14f69229cffa97e7ae04d90534ec8f700cf991dd 100644 (file)
@@ -3,15 +3,15 @@
 include $(PWD)/Platform/$(PLATFORM).mk
 
 .PHONY: all clean
-.SUFFIXES: .c .o .so
+.SUFFIXES: .c .o $(LIB)
 
-all: mod_example.so mod_cgi.so
+all: mod_cgi$(LIB)
 
-.o.so:
+.o$(LIB):
        $(CC) $(LDFLAGS) -shared -o $@ $< ../Common/common.a $(LIBS)
 
 .c.o:
-       $(CC) $(CFLAGS) -fPIC -c -o $@ $<
+       $(CC) $(CFLAGS) -c -o $@ $<
 
 clean:
        rm -f *.o *.so *.a
index b4ec678c9a8a0a8c7019f43e1209a4a4b142b04b..42df82f767cd00f1256a87925ccff9861863be85 100644 (file)
@@ -2,6 +2,8 @@
 
 #include "../Server/tw_module.h"
 
+#include <cm_string.h>
+
 int mod_init(struct tw_config* config, struct tw_tool* tools) {
        tools->log("CGI", "Initializing CGI module");
        tools->add_version("CGI/1.1");
@@ -9,8 +11,10 @@ int mod_init(struct tw_config* config, struct tw_tool* tools) {
 }
 
 int mod_config(struct tw_tool* tools, char** argv, int argc) {
-       printf("args %d\n", argc);
-       return TW_CONFIG_ERROR;
+       if(cm_strcaseequ(argv[0], "AllowCGI")) {
+               return TW_CONFIG_PARSED;
+       }
+       return TW_CONFIG_NOTME;
 }
 
 int mod_request(struct tw_tool* tools, struct tw_http_request* req, struct tw_http_response* res) { return TW_MODULE_PASS; }
index fb223736b576ee932d2a070bce038ee9295e9e54..6e8d9e20acfc88528b85c7e3c4fc89393179592b 100644 (file)
@@ -1,4 +1,5 @@
 /* $Id$ */
+/* This module will accept all directives, and always return 403 on the access. */
 
 #include "../Server/tw_module.h"
 
@@ -8,4 +9,6 @@ int mod_init(struct tw_config* config, struct tw_tool* tools) {
        return 0;
 }
 
+int mod_config(struct tw_tool* tools, char** argv, int argc) { return TW_CONFIG_PARSED; }
+
 int mod_request(struct tw_tool* tools, struct tw_http_request* req, struct tw_http_response* res) { return TW_MODULE_ERROR(403); }
index 5e45edb384b1c7be50dd63a2dc276a5df08fe62f..2b73ed01940f1f02cbec8496a88692a3770ff84c 100644 (file)
@@ -2,7 +2,7 @@
 
 CC = cc
 AR = ar
-CFLAGS = -g -std=c99 -DPREFIX=\"$(PREFIX)\" -I $(PWD)/Common
+CFLAGS = -g -std=c99 -DPREFIX=\"$(PREFIX)\" -I $(PWD)/Common -fPIC
 LDFLAGS =
 LIBS =
 EXEC =
index 57ba10ceb6dd6023d752ee179fdb7fb55add488b..7c2b6032f7c5610665bc25f3c0d97ce99406d90a 100644 (file)
@@ -2,7 +2,7 @@
 
 CC = cc
 AR = ar
-CFLAGS = -g -std=c99 -DPREFIX=\"$(PREFIX)\" -I $(PWD)/Common -D_DEFAULT_SOURCE
+CFLAGS = -g -std=c99 -DPREFIX=\"$(PREFIX)\" -I $(PWD)/Common -D_DEFAULT_SOURCE -fPIC
 LDFLAGS =
 LIBS =
 EXEC =
index b353c38ec41d859c378c3f24cd105ab03cea8b02..265225bf694266f607fb890ad49968a3f438c0e0 100644 (file)
@@ -4,7 +4,7 @@ PREFIX = C:/Tewi
 
 CC = x86_64-w64-mingw32-gcc
 AR = x86_64-w64-mingw32-ar
-CFLAGS = -g -std=c99 -DPREFIX=\"$(PREFIX)\" -I $(PWD)/Common -I $(PWD)/openssl/include
+CFLAGS = -g -std=c99 -DPREFIX=\"$(PREFIX)\" -I $(PWD)/Common -I $(PWD)/openssl/include -fPIC
 LDFLAGS = -L $(PWD)/openssl/lib
 LIBS = -lws2_32
 EXEC = .exe
index 9e662c5f7b2030682a815613a8a32362151965dc..3a63a026638028fc08b62e56c8c542b81258cba2 100644 (file)
@@ -29,3 +29,7 @@ DocumentRoot /var/www
 BeginDirectory /
        Allow all
 EndDirectory
+
+BeginDirectory /var/www/cgi-bin
+       AllowCGI
+EndDirectory