From 22384efcac0da2e7e44fa49ee88f801da73d4ef8 Mon Sep 17 00:00:00 2001 From: miker Date: Thu, 29 Oct 2009 01:00:26 +0000 Subject: [PATCH] adding specialized apache module for returning specific classes from the IDL xml git-svn-id: svn://svn.open-ils.org/ILS/trunk@14660 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- Open-ILS/examples/apache/eg_vhost.conf | 12 +- Open-ILS/src/apachemods/Makefile.am | 3 + Open-ILS/src/apachemods/mod_idlchunk.c | 637 +++++++++++++++++++++++++++++++++ 3 files changed, 647 insertions(+), 5 deletions(-) create mode 100644 Open-ILS/src/apachemods/mod_idlchunk.c diff --git a/Open-ILS/examples/apache/eg_vhost.conf b/Open-ILS/examples/apache/eg_vhost.conf index 43885311d4..c6c032ef36 100644 --- a/Open-ILS/examples/apache/eg_vhost.conf +++ b/Open-ILS/examples/apache/eg_vhost.conf @@ -321,12 +321,14 @@ RewriteRule - - [E=locale:en-US] [L] Options +Includes AddOutputFilter INCLUDES;XMLENT .xhtml + - Options +Includes - XMLEntStripDoctype "yes" - XMLEntStripComments "no" - XMLEntContentType "text/xml; charset=utf-8" - AddOutputFilter INCLUDES;XMLENT .xml + IDLChunkStripPI "yes" + IDLChunkEscapeScript "no" + IDLChunkStripComments "yes" + IDLChunkStripDoctype "yes" + IDLChunkContentType "application/xml; charset=utf-8" + AddOutputFilter IDLCHUNK .xml # ---------------------------------------------------------------------------------- diff --git a/Open-ILS/src/apachemods/Makefile.am b/Open-ILS/src/apachemods/Makefile.am index 07eecfa31a..536087509b 100644 --- a/Open-ILS/src/apachemods/Makefile.am +++ b/Open-ILS/src/apachemods/Makefile.am @@ -16,6 +16,9 @@ install-exec-local: $(OILSAPACHEINST) apachemods: $(APXS2) -c $(AM_LDFLAGS) -lxml2 -lopensrf -lxslt -lexpat $(AM_CFLAGS) @srcdir@/mod_xmlent.c $(APXS2) -i -a @srcdir@/mod_xmlent.la + $(APXS2) -c $(AM_LDFLAGS) -lxml2 -lopensrf -lxslt -lexpat $(AM_CFLAGS) @srcdir@/mod_idlchunk.c + $(APXS2) -i -a @srcdir@/mod_idlchunk.la clean-local: rm -f @srcdir@/mod_xmlent.la @srcdir@/mod_xmlent.lo @srcdir@/mod_xmlent.slo + rm -f @srcdir@/mod_idlchunk.la @srcdir@/mod_idlchunk.lo @srcdir@/mod_idlchunk.slo diff --git a/Open-ILS/src/apachemods/mod_idlchunk.c b/Open-ILS/src/apachemods/mod_idlchunk.c new file mode 100644 index 0000000000..0cc7a5fcfb --- /dev/null +++ b/Open-ILS/src/apachemods/mod_idlchunk.c @@ -0,0 +1,637 @@ +#include "httpd.h" +/* vim:noet:ts=4 + */ +#include "http_config.h" +#include "http_core.h" +#include "http_protocol.h" +#include "http_request.h" +//#include "apr_compat.h" +#include "apr_strings.h" +#include "apr_reslist.h" +#include "http_log.h" +#include "util_filter.h" +#include "opensrf/string_array.h" +#include "opensrf/utils.h" +#include "opensrf/log.h" + +#include +#include +#include + +#define APACHE_TOOLS_MAX_POST_SIZE 10485760 /* 10 MB */ +#define MODULE_NAME "idlchunk_module" + +/* Define the config defaults here */ +#define MODIDLCHUNK_CONFIG_STRIP_COMMENTS "IDLChunkStripComments" +#define MODIDLCHUNK_CONFIG_CONTENT_TYPE "IDLChunkContentType" +#define MODIDLCHUNK_CONFIG_CONTENT_TYPE_DEFAULT "text/html" +#define MODIDLCHUNK_CONFIG_STRIP_PI "IDLChunkStripPI" +#define MODIDLCHUNK_CONFIG_DOCTYPE "IDLChunkDoctype" +#define MODIDLCHUNK_CONFIG_STRIP_DOCTYPE "IDLChunkStripDoctype" +#define MODIDLCHUNK_CONFIG_ESCAPE_SCRIPT "IDLChunkEscapeScript" + +module AP_MODULE_DECLARE_DATA idlchunk_module; + +int idlChunkInScript = 0; /* are we in the middle of a