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
#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");
}
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; }
/* $Id$ */
+/* This module will accept all directives, and always return 403 on the access. */
#include "../Server/tw_module.h"
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); }
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 =
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 =
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
BeginDirectory /
Allow all
EndDirectory
+
+BeginDirectory /var/www/cgi-bin
+ AllowCGI
+EndDirectory