From 49d13db97fdf2f6bdb85206327d03a998b175524 Mon Sep 17 00:00:00 2001 From: Nishi Date: Sat, 24 Aug 2024 08:38:48 +0000 Subject: [PATCH] adding apache2 mod, might work on it later. git-svn-id: file:///raid/svn-personal/repoview/trunk@69 7e8b2a19-8934-dd40-8cb3-db22cdd5a80f --- repoview/.deps | 0 repoview/Makefile | 45 +++++++++++++++++++++++++ repoview/mod_repoview.c | 73 +++++++++++++++++++++++++++++++++++++++++ repoview/modules.mk | 4 +++ 4 files changed, 122 insertions(+) create mode 100644 repoview/.deps create mode 100644 repoview/Makefile create mode 100644 repoview/mod_repoview.c create mode 100644 repoview/modules.mk diff --git a/repoview/.deps b/repoview/.deps new file mode 100644 index 0000000..e69de29 diff --git a/repoview/Makefile b/repoview/Makefile new file mode 100644 index 0000000..198f0f4 --- /dev/null +++ b/repoview/Makefile @@ -0,0 +1,45 @@ +## +## Makefile -- Build procedure for sample repoview Apache module +## Autogenerated via ``apxs -n repoview -g''. +## + +builddir=. +top_srcdir=/usr/share/apache2 +top_builddir=/usr/share/apache2 +include /usr/share/apache2/build/special.mk + +# the used tools +APACHECTL=apachectl + +# additional defines, includes and libraries +#DEFS=-Dmy_define=my_value +#INCLUDES=-Imy/include/dir +#LIBS=-Lmy/lib/dir -lmylib + +# the default target +all: local-shared-build + +# install the shared object file into Apache +install: install-modules-yes + +# cleanup +clean: + -rm -f mod_repoview.o mod_repoview.lo mod_repoview.slo mod_repoview.la + +# simple test +test: reload + lynx -mime_header http://localhost/repoview + +# install and activate shared object by reloading Apache to +# force a reload of the shared object file +reload: install restart + +# the general Apache start/restart/stop +# procedures +start: + $(APACHECTL) start +restart: + $(APACHECTL) restart +stop: + $(APACHECTL) stop + diff --git a/repoview/mod_repoview.c b/repoview/mod_repoview.c new file mode 100644 index 0000000..dda6f0e --- /dev/null +++ b/repoview/mod_repoview.c @@ -0,0 +1,73 @@ +/* +** mod_repoview.c -- Apache sample repoview module +** [Autogenerated via ``apxs -n repoview -g''] +** +** To play with this sample module first compile it into a +** DSO file and install it into Apache's modules directory +** by running: +** +** $ apxs -c -i mod_repoview.c +** +** Then activate it in Apache's apache2.conf file for instance +** for the URL /repoview in as follows: +** +** # apache2.conf +** LoadModule repoview_module modules/mod_repoview.so +** +** SetHandler repoview +** +** +** Then after restarting Apache via +** +** $ apachectl restart +** +** you immediately can request the URL /repoview and watch for the +** output of this module. This can be achieved for instance via: +** +** $ lynx -mime_header http://localhost/repoview +** +** The output should be similar to the following one: +** +** HTTP/1.1 200 OK +** Date: Tue, 31 Mar 1998 14:42:22 GMT +** Server: Apache/1.3.4 (Unix) +** Connection: close +** Content-Type: text/html +** +** The sample page from mod_repoview.c +*/ + +#include "httpd.h" +#include "http_config.h" +#include "http_protocol.h" +#include "ap_config.h" + +/* The sample content handler */ +static int repoview_handler(request_rec *r) +{ + if (strcmp(r->handler, "repoview")) { + return DECLINED; + } + r->content_type = "text/html"; + + if (!r->header_only) + ap_rputs("The sample page from mod_repoview.c\n", r); + return OK; +} + +static void repoview_register_hooks(apr_pool_t *p) +{ + ap_hook_handler(repoview_handler, NULL, NULL, APR_HOOK_MIDDLE); +} + +/* Dispatch list for API hooks */ +module AP_MODULE_DECLARE_DATA repoview_module = { + STANDARD20_MODULE_STUFF, + NULL, /* create per-dir config structures */ + NULL, /* merge per-dir config structures */ + NULL, /* create per-server config structures */ + NULL, /* merge per-server config structures */ + NULL, /* table of config file commands */ + repoview_register_hooks /* register hooks */ +}; + diff --git a/repoview/modules.mk b/repoview/modules.mk new file mode 100644 index 0000000..ea3eda9 --- /dev/null +++ b/repoview/modules.mk @@ -0,0 +1,4 @@ +mod_repoview.la: mod_repoview.slo + $(SH_LINK) -rpath $(libexecdir) -module -avoid-version mod_repoview.lo +DISTCLEAN_TARGETS = modules.mk +shared = mod_repoview.la -- 2.45.2