use dll for windows build

git-svn-id: file:///raid/svn-personal/tewi/trunk@40 8739d7e6-ffea-ec47-b151-bdff447c6205
This commit is contained in:
Nishi 2024-09-17 12:31:08 +00:00
parent 2d552b27ab
commit bf87d827d3
7 changed files with 20 additions and 9 deletions

View 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

View 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; }

View 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); }

View 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 =

View 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 =

View 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

View File

@ -29,3 +29,7 @@ DocumentRoot /var/www
BeginDirectory /
Allow all
EndDirectory
BeginDirectory /var/www/cgi-bin
AllowCGI
EndDirectory