OSDN Git Service

* Added test code.
authorkonn <konn@1a406e8e-add9-4483-a2c8-d8cac5b7c224>
Sat, 5 Apr 2008 08:50:28 +0000 (08:50 +0000)
committerkonn <konn@1a406e8e-add9-4483-a2c8-d8cac5b7c224>
Sat, 5 Apr 2008 08:50:28 +0000 (08:50 +0000)
git-svn-id: svn+ssh://svn.sourceforge.jp/svnroot/modchxj/mod_chxj/branches/RELEASE_0_11_0@1991 1a406e8e-add9-4483-a2c8-d8cac5b7c224

33 files changed:
configure
configure.ac
include/chxj_qr_code.h
include/config.h
include/mod_chxj.h
include/qs_parse_string.h
include/test_config.h [new file with mode: 0644]
src/Makefile.am
src/Makefile.in
src/chxj_apache.c [new file with mode: 0644]
src/chxj_chtml10.c
src/chxj_chtml20.c
src/chxj_chtml30.c
src/chxj_cookie.c
src/chxj_dbm.c
src/chxj_encoding.c
src/chxj_hdml.c
src/chxj_img_conv_format.c
src/chxj_jhtml.c
src/chxj_qr_code.c
src/chxj_specified_device.c
src/chxj_xhtml_mobile_1_0.c
src/mod_chxj.c
src/qs_log.c
src/qs_parse_string.c
test/chxj_chtml10/.tb.Makefile.tags [new file with mode: 0644]
test/chxj_chtml10/.tb.test_chxj_chtml10.c.tags [new file with mode: 0644]
test/chxj_chtml10/Makefile [new file with mode: 0644]
test/chxj_chtml10/erer [new file with mode: 0644]
test/chxj_chtml10/test_chxj_chtml10 [new file with mode: 0755]
test/chxj_chtml10/test_chxj_chtml10.c [new file with mode: 0644]
test/qs_parse_string/Makefile [new file with mode: 0644]
test/qs_parse_string/test_parse_comment_tag.c [new file with mode: 0644]

index 3d3ef43..185cf72 100755 (executable)
--- a/configure
+++ b/configure
@@ -20951,7 +20951,7 @@ echo "$as_me: error: pcre-config and pcre-1-config not found." >&2;}
 else
 
 cat >>confdefs.h <<\_ACEOF
-#define HAVE_AP_REGEX_H
+#define HAVE_AP_REGEX_H 1
 _ACEOF
 
 fi
index ccb5a26..3f73991 100644 (file)
@@ -285,7 +285,7 @@ if test "x$use_pcre_flag" = "xyes" ; then
   fi
   CFLAGS="${CFLAGS} `${PCRE_CONFIG} --cflags`"
 else
-  AC_DEFINE([HAVE_AP_REGEX_H], [], [Define to 1 if you have the <ap_regex.h> header file.])
+  AC_DEFINE([HAVE_AP_REGEX_H], [1], [Define to 1 if you have the <ap_regex.h> header file.])
 fi
 
 # Checks for typedefs, structures, and compiler characteristics.
index 2ee0ce9..a0ba8bf 100644 (file)
@@ -17,7 +17,7 @@
 #ifndef __CHXJ_QR_CODE_H__
 #define __CHXJ_QR_CODE_H__
 
-#include "httpd.h"
+#include "chxj_apache.h"
 #include "qs_parse_string.h"
 
 typedef enum _qr_ver_t {
index 0908c24..1b32dea 100644 (file)
@@ -14,7 +14,7 @@
 #define HAVE_AP_CONFIG_H 1
 
 /* Define to 1 if you have the <ap_regex.h> header file. */
-#define HAVE_AP_REGEX_H 
+#define HAVE_AP_REGEX_H 1
 
 /* Define to 1 if you have the `close' function. */
 #define HAVE_CLOSE 1
index ef4367b..0f35980 100644 (file)
 
 #include <string.h>
 
-#include "httpd.h"
-#include "http_config.h"
-#include "http_protocol.h"
-#include "http_request.h"
-#include "http_log.h"
-#include "ap_config.h"
+#include "chxj_apache.h"
+
 #include "apr_strings.h"
 #include "apr_buckets.h"
 #include "apr_lib.h"
@@ -47,7 +43,6 @@
 #include "apr_dso.h"
 #include "apr_general.h"
 #include "apr_pools.h"
-#include "util_filter.h"
 
 #if defined(AP_NEED_SET_MUTEX_PERMS)
 #  include "unixd.h"
 #include "qs_parse_string.h"
 #include "qs_parse_tag.h"
 
-#ifndef __CONFIG_H__
-#define __CONFIG_H__
-
-#undef PACKAGE_NAME
-#undef PACKAGE_STRING
-#undef PACKAGE_TARNAME
-#undef PACKAGE_VERSION
-
-#include "config.h"
-#endif
-#ifdef HAVE_AP_REGEX_H
+#if defined(HAVE_AP_REGEX_H) && HAVE_AP_REGEX_H == 1
 #  include "ap_regex.h"
 #else
 #  include "pcreposix.h"
@@ -390,11 +375,11 @@ module AP_MODULE_DECLARE_DATA chxj_module;
 #define CHXJ_IMG_OFF    (0)
 
 
-#define DBG(X,args...)  ap_log_rerror(APLOG_MARK,APLOG_DEBUG,0,(request_rec*)(X),##args)
-#define SDBG(X,Y)  ap_log_error(APLOG_MARK,APLOG_DEBUG,0,(X),(Y))
-#define ERR(X,args...)  ap_log_rerror(APLOG_MARK,APLOG_ERR,0,(X), ##args)
-#define SERR(X,Y)  ap_log_error(APLOG_MARK,APLOG_ERR,0,(X),(Y))
-#define WRN(rec,format,args...)  ap_log_rerror(APLOG_MARK,APLOG_WARNING,0,(rec),(format), ##args)
+#define DBG(X,args...)  chxj_log_rerror(APLOG_MARK,APLOG_DEBUG,0,(request_rec*)(X),##args)
+#define SDBG(X,Y)       chxj_log_error(APLOG_MARK,APLOG_DEBUG,0,(X),(Y))
+#define ERR(X,args...)  chxj_log_rerror(APLOG_MARK,APLOG_ERR,0,(X), ##args)
+#define SERR(X,Y)       chxj_log_error(APLOG_MARK,APLOG_ERR,0,(X),(Y))
+#define WRN(rec,format,args...)  chxj_log_rerror(APLOG_MARK,APLOG_WARNING,0,(rec),(format), ##args)
 
 extern tag_handlers chxj_tag_handlers[];
 extern tag_handler  chtml10_handler[];
index 4a3f6f0..cef4966 100644 (file)
@@ -17,8 +17,7 @@
 #ifndef __QS_PARSE_STRING_H__
 #define __QS_PARSE_STRING_H__
 
-#include <httpd.h>
-
+#include "chxj_apache.h"
 #include "chxj_buffered_write.h"
 
 /*
diff --git a/include/test_config.h b/include/test_config.h
new file mode 100644 (file)
index 0000000..d4f9aaf
--- /dev/null
@@ -0,0 +1,117 @@
+/* include/config.h.  Generated from config.h.in by configure.  */
+/* include/config.h.in.  Generated from configure.ac by autoheader.  */
+
+/* Define to 1 if you have the <apr_global_mutex.h> header file. */
+#define HAVE_APR_GLOBAL_MUTEX_H 1
+
+/* Define to 1 if you have the <apr.h> header file. */
+#define HAVE_APR_H 1
+
+/* Define to 1 if you have the <apr_shm.h> header file. */
+#define HAVE_APR_SHM_H 1
+
+/* Define to 1 if you have the <ap_config.h> header file. */
+#define HAVE_AP_CONFIG_H 1
+
+/* Define to 1 if you have the <ap_regex.h> header file. */
+#define HAVE_AP_REGEX_H 0
+
+/* Define to 1 if you have the `close' function. */
+#define HAVE_CLOSE 1
+
+/* Define to 1 if you have the <dlfcn.h> header file. */
+#define HAVE_DLFCN_H 1
+
+/* Define to 1 if you have the <fcntl.h> header file. */
+#define HAVE_FCNTL_H 1
+
+/* Define to 1 if you have the <inttypes.h> header file. */
+#define HAVE_INTTYPES_H 1
+
+/* Define to 1 if you have the `apr-1' library (-lapr-1). */
+#define HAVE_LIBAPR_1 1
+
+/* Define to 1 if you have the <libgen.h> header file. */
+#define HAVE_LIBGEN_H 1
+
+/* Define to 1 if your system has a GNU libc compatible `malloc' function, and
+   to 0 otherwise. */
+#define HAVE_MALLOC 1
+
+/* Define to 1 if you have the `memcpy' function. */
+#define HAVE_MEMCPY 1
+
+/* Define to 1 if you have the <memory.h> header file. */
+#define HAVE_MEMORY_H 1
+
+/* Define to 1 if you have the `memset' function. */
+#define HAVE_MEMSET 1
+
+/* Define to 1 if you have the `mmap' function. */
+#define HAVE_MMAP 1
+
+/* Define to 1 if you have the `open' function. */
+#define HAVE_OPEN 1
+
+/* Define to 1 if you have the <stdint.h> header file. */
+#define HAVE_STDINT_H 1
+
+/* Define to 1 if you have the <stdlib.h> header file. */
+#define HAVE_STDLIB_H 1
+
+/* Define to 1 if you have the `strcasecmp' function. */
+#define HAVE_STRCASECMP 1
+
+/* Define to 1 if you have the <strings.h> header file. */
+#define HAVE_STRINGS_H 1
+
+/* Define to 1 if you have the <string.h> header file. */
+#define HAVE_STRING_H 1
+
+/* Define to 1 if you have the `strncasecmp' function. */
+#define HAVE_STRNCASECMP 1
+
+/* Define to 1 if you have the `strstr' function. */
+#define HAVE_STRSTR 1
+
+/* Define to 1 if you have the <sys/mman.h> header file. */
+#define HAVE_SYS_MMAN_H 1
+
+/* Define to 1 if you have the <sys/stat.h> header file. */
+#define HAVE_SYS_STAT_H 1
+
+/* Define to 1 if you have the <sys/types.h> header file. */
+#define HAVE_SYS_TYPES_H 1
+
+/* Define to 1 if you have the <unistd.h> header file. */
+#define HAVE_UNISTD_H 1
+
+/* Name of package */
+#define PACKAGE "mod_chxj"
+
+/* Define to the address where bug reports for this package should be sent. */
+#define PACKAGE_BUGREPORT ""
+
+/* Define to the full name of this package. */
+#define PACKAGE_NAME "mod_chxj"
+
+/* Define to the full name and version of this package. */
+#define PACKAGE_STRING "mod_chxj 0.11.0-1"
+
+/* Define to the one symbol short name of this package. */
+#define PACKAGE_TARNAME "mod_chxj"
+
+/* Define to the version of this package. */
+#define PACKAGE_VERSION "0.11.0-1"
+
+/* Define to 1 if you have the ANSI C header files. */
+#define STDC_HEADERS 1
+
+/* Version number of package */
+#define VERSION "0.11.0-1"
+
+/* Define to empty if `const' does not conform to ANSI C. */
+/* #undef const */
+
+/* Define to rpl_malloc if the replacement function should be used. */
+/* #undef malloc */
index 945e169..29d6a3a 100644 (file)
@@ -33,7 +33,8 @@ libmod_chxj_la_SOURCES = mod_chxj.c \
     chxj_mysql.c \
     chxj_memcache.c \
     chxj_dbm.c \
-    chxj_buffered_write.c
+    chxj_buffered_write.c \
+    chxj_apache.c
 
 
 libmod_chxj_la_CFLAGS = -O2 -prefer-pic @QDEFS@ @DDEFS@ -I. -I../include -I@with_apache_header@ 
index 3c21816..055be62 100644 (file)
@@ -75,7 +75,8 @@ am_libmod_chxj_la_OBJECTS = libmod_chxj_la-mod_chxj.lo \
        libmod_chxj_la-chxj_preg_replace.lo \
        libmod_chxj_la-chxj_cookie.lo libmod_chxj_la-chxj_mysql.lo \
        libmod_chxj_la-chxj_memcache.lo libmod_chxj_la-chxj_dbm.lo \
-       libmod_chxj_la-chxj_buffered_write.lo
+       libmod_chxj_la-chxj_buffered_write.lo \
+       libmod_chxj_la-chxj_apache.lo
 libmod_chxj_la_OBJECTS = $(am_libmod_chxj_la_OBJECTS)
 libmod_chxj_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
        $(LIBTOOLFLAGS) --mode=link $(CCLD) $(libmod_chxj_la_CFLAGS) \
@@ -253,7 +254,8 @@ libmod_chxj_la_SOURCES = mod_chxj.c \
     chxj_mysql.c \
     chxj_memcache.c \
     chxj_dbm.c \
-    chxj_buffered_write.c
+    chxj_buffered_write.c \
+    chxj_apache.c
 
 libmod_chxj_la_CFLAGS = -O2 -prefer-pic @QDEFS@ @DDEFS@ -I. -I../include -I@with_apache_header@ 
 AM_CFLAGS = @CFLAGS@ -O2 -prefer-pic @QDEFS@ @DDEFS@ -I. -I../include -I@with_apache_header@
@@ -327,6 +329,7 @@ mostlyclean-compile:
 distclean-compile:
        -rm -f *.tab.c
 
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmod_chxj_la-chxj_apache.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmod_chxj_la-chxj_apply_convrule.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmod_chxj_la-chxj_buffered_write.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmod_chxj_la-chxj_calc_ecc.Plo@am__quote@
@@ -621,6 +624,13 @@ libmod_chxj_la-chxj_buffered_write.lo: chxj_buffered_write.c
 @AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCC_FALSE@  $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmod_chxj_la_CFLAGS) $(CFLAGS) -c -o libmod_chxj_la-chxj_buffered_write.lo `test -f 'chxj_buffered_write.c' || echo '$(srcdir)/'`chxj_buffered_write.c
 
+libmod_chxj_la-chxj_apache.lo: chxj_apache.c
+@am__fastdepCC_TRUE@   $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmod_chxj_la_CFLAGS) $(CFLAGS) -MT libmod_chxj_la-chxj_apache.lo -MD -MP -MF $(DEPDIR)/libmod_chxj_la-chxj_apache.Tpo -c -o libmod_chxj_la-chxj_apache.lo `test -f 'chxj_apache.c' || echo '$(srcdir)/'`chxj_apache.c
+@am__fastdepCC_TRUE@   mv -f $(DEPDIR)/libmod_chxj_la-chxj_apache.Tpo $(DEPDIR)/libmod_chxj_la-chxj_apache.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='chxj_apache.c' object='libmod_chxj_la-chxj_apache.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmod_chxj_la_CFLAGS) $(CFLAGS) -c -o libmod_chxj_la-chxj_apache.lo `test -f 'chxj_apache.c' || echo '$(srcdir)/'`chxj_apache.c
+
 mostlyclean-libtool:
        -rm -f *.lo
 
diff --git a/src/chxj_apache.c b/src/chxj_apache.c
new file mode 100644 (file)
index 0000000..83df4a7
--- /dev/null
@@ -0,0 +1,65 @@
+/*
+ * Copyright (C) 2005-2008 Atsushi Konno All rights reserved.
+ * Copyright (C) 2005 QSDN,Inc. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#include "chxj_apache.h"
+
+const char *
+chxj_apache_run_http_scheme(request_rec *r)
+{
+#if defined(CHXJ_TEST)
+  return test_run_http_scheme(r);
+#else
+#  if AP_SERVER_MAJORVERSION_NUMBER == 2 && AP_SERVER_MINORVERSION_NUMBER == 2
+  return ap_run_http_scheme(r);
+#  else
+  return ap_run_http_method(r);
+#  endif
+#endif
+}
+
+char *chxj_os_escape_path(apr_pool_t *p, const char *path, int partial) 
+{
+#if defined(CHXJ_TEST)
+  return test_os_escape_path(p, path, partial);
+#else
+  return ap_os_escape_path(p, path, partial);
+#endif
+}
+
+
+void
+chxj_set_content_type(request_rec *r, const char *ct)
+{
+#if defined(CHXJ_TEST)
+  test_set_content_type(r, ct);
+#else
+  ap_set_content_type(r, ct);
+#endif
+}
+
+
+void *
+chxj_get_module_config(const ap_conf_vector_t *cv, const module *m)
+{
+#if defined(CHXJ_TEST)
+  return test_get_module_config(cv,m);
+#else
+  return ap_get_module_config(cv,m);
+#endif
+}
+/*
+ * vim:ts=2 et
+ */
index 8b8227b..58dcdd9 100644 (file)
@@ -373,7 +373,7 @@ chxj_exchange_chtml10(
   chtml10.entryp    = entryp;
   chtml10.cookie    = cookie;
 
-  ap_set_content_type(r, "text/html; charset=Windows-31J");
+  chxj_set_content_type(r, "text/html; charset=Windows-31J");
 
   /*--------------------------------------------------------------------------*/
   /* The character string of the input is analyzed.                           */
@@ -445,7 +445,7 @@ s_init_chtml10(
   chtml10->doc  = doc;
   chtml10->spec = spec;
   chtml10->out  = qs_alloc_zero_byte_string(r);
-  chtml10->conf = ap_get_module_config(r->per_dir_config, &chxj_module);
+  chtml10->conf = chxj_get_module_config(r->per_dir_config, &chxj_module);
   chtml10->doc->parse_mode = PARSE_MODE_CHTML;
 }
 
index 31df5ae..fc60bba 100644 (file)
@@ -371,7 +371,7 @@ chxj_exchange_chtml20(
   chtml20.entryp = entryp;
   chtml20.cookie = cookie;
 
-  ap_set_content_type(r, "text/html; charset=Windows-31J");
+  chxj_set_content_type(r, "text/html; charset=Windows-31J");
 
   /*--------------------------------------------------------------------------*/
   /* The character string of the input is analyzed.                           */
@@ -437,7 +437,7 @@ s_init_chtml20(chtml20_t *chtml20, Doc *doc, request_rec *r, device_table *spec)
   chtml20->doc  = doc;
   chtml20->spec = spec;
   chtml20->out  = qs_alloc_zero_byte_string(r);
-  chtml20->conf = ap_get_module_config(r->per_dir_config, &chxj_module);
+  chtml20->conf = chxj_get_module_config(r->per_dir_config, &chxj_module);
 
   chtml20->doc->parse_mode = PARSE_MODE_CHTML;
 }
index 1c82e12..4b416db 100644 (file)
@@ -372,7 +372,7 @@ chxj_exchange_chtml30(
   chtml30.entryp = entryp;
   chtml30.cookie = cookie;
 
-  ap_set_content_type(r, "text/html; charset=Windows-31J");
+  chxj_set_content_type(r, "text/html; charset=Windows-31J");
 
   /*--------------------------------------------------------------------------*/
   /* The character string of the input is analyzed.                           */
@@ -439,7 +439,7 @@ s_init_chtml30(chtml30_t* chtml30, Doc* doc, request_rec* r, device_table* spec)
   chtml30->doc  = doc;
   chtml30->spec = spec;
   chtml30->out  = qs_alloc_zero_byte_string(r);
-  chtml30->conf = ap_get_module_config(r->per_dir_config, &chxj_module);
+  chtml30->conf = chxj_get_module_config(r->per_dir_config, &chxj_module);
   chtml30->doc->parse_mode = PARSE_MODE_CHTML;
 }
 
index 2514413..8457acf 100644 (file)
@@ -119,7 +119,7 @@ chxj_save_cookie(request_rec* r)
   has_cookie = 0;
   has_refer = 0;
 
-  dconf = ap_get_module_config(r->per_dir_config, &chxj_module);
+  dconf = chxj_get_module_config(r->per_dir_config, &chxj_module);
   entryp = chxj_apply_convrule(r, dconf->convrules);
   if (! entryp) {
     DBG(r, "end chxj_save_cookie() no pattern");
@@ -168,11 +168,7 @@ chxj_save_cookie(request_rec* r)
     apr_uri_parse(r->pool,r->uri, &parsed_uri);
     refer_string = apr_psprintf(r->pool, 
                                 "%s://%s%s", 
-#if AP_SERVER_MAJORVERSION_NUMBER == 2 && AP_SERVER_MINORVERSION_NUMBER == 2
-                                ap_run_http_scheme(r),
-#else
-                                ap_run_http_method(r),
-#endif
+                                chxj_run_http_scheme(r),
                                 r->hostname,
                                 apr_uri_unparse(r->pool,
                                                 &parsed_uri,
@@ -306,7 +302,7 @@ chxj_update_cookie(request_rec* r, cookie_t* old_cookie)
   cookie->cookie_id = NULL;
 
 
-  dconf = ap_get_module_config(r->per_dir_config, &chxj_module);
+  dconf = chxj_get_module_config(r->per_dir_config, &chxj_module);
   entryp = chxj_apply_convrule(r, dconf->convrules);
   if (! entryp) {
     DBG(r, "end chxj_update_cookie() no pattern");
@@ -423,7 +419,7 @@ chxj_load_cookie(request_rec* r, char* cookie_id)
   cookie->cookie_headers = NULL;
   cookie->cookie_id = apr_pstrdup(r->pool, cookie_id);
 
-  dconf = ap_get_module_config(r->per_dir_config, &chxj_module);
+  dconf = chxj_get_module_config(r->per_dir_config, &chxj_module);
   entryp = chxj_apply_convrule(r, dconf->convrules);
   if (! entryp) {
     DBG(r, "end chxj_load_cookie() no pattern");
@@ -710,11 +706,7 @@ valid_secure(request_rec *r, const char *value)
 {
   const char *scheme;
   DBG(r, "start valid_secure() value:[%s]", value);
-#if AP_SERVER_MAJORVERSION_NUMBER == 2 && AP_SERVER_MINORVERSION_NUMBER == 2
-  scheme = ap_run_http_scheme(r);
-#else
-  scheme = ap_run_http_method(r);
-#endif
+  scheme = chxj_apache_run_http_scheme(r);
   if (strcasecmp("https", scheme)) {
     DBG(r, "end valid_secure() value:[%s] (non secure)", value);
     return CHXJ_FALSE;
@@ -822,7 +814,7 @@ chxj_delete_cookie(request_rec *r, const char *cookie_id)
   mod_chxj_config *dconf;
 
   DBG(r, "start chxj_delete_cookie()");
-  dconf = ap_get_module_config(r->per_dir_config, &chxj_module);
+  dconf = chxj_get_module_config(r->per_dir_config, &chxj_module);
 
 #if defined(USE_MYSQL_COOKIE)
   if (IS_COOKIE_STORE_MYSQL(dconf->cookie_store_type)) {
@@ -876,7 +868,7 @@ chxj_save_cookie_expire(request_rec* r, cookie_t* cookie)
     return;
   }
 
-  dconf = ap_get_module_config(r->per_dir_config, &chxj_module);
+  dconf = chxj_get_module_config(r->per_dir_config, &chxj_module);
   if (!dconf) {
     DBG(r, "dconf is NULL");
     return;
@@ -925,7 +917,7 @@ chxj_delete_cookie_expire(request_rec* r, char* cookie_id)
 
   DBG(r, "start chxj_delete_cookie_expire()");
 
-  dconf = ap_get_module_config(r->per_dir_config, &chxj_module);
+  dconf = chxj_get_module_config(r->per_dir_config, &chxj_module);
 
 #if defined(USE_MYSQL_COOKIE)
   if (IS_COOKIE_STORE_MYSQL(dconf->cookie_store_type)) {
@@ -966,7 +958,7 @@ chxj_cookie_expire_gc(request_rec* r)
 
   DBG(r, "start chxj_cookie_expire_gc()");
 
-  dconf = ap_get_module_config(r->per_dir_config, &chxj_module);
+  dconf = chxj_get_module_config(r->per_dir_config, &chxj_module);
 #if defined(USE_MYSQL_COOKIE)
   if (IS_COOKIE_STORE_MYSQL(dconf->cookie_store_type)) {
     if (! chxj_cookie_expire_gc_mysql(r, dconf)) {
index 170a9bb..e46c515 100644 (file)
@@ -116,7 +116,7 @@ chxj_cookie_db_lock(request_rec *r)
   apr_status_t     rv;
   mod_chxj_config  *dconf;
 
-  dconf = (mod_chxj_config*)ap_get_module_config(r->per_dir_config, &chxj_module);
+  dconf = (mod_chxj_config*)chxj_get_module_config(r->per_dir_config, &chxj_module);
 
   rv = apr_file_open(&file,
                      chxj_cookie_db_lock_name_create(r, dconf->cookie_db_dir),
@@ -242,7 +242,7 @@ chxj_cookie_expire_db_lock(request_rec *r)
   apr_status_t     rv;
   mod_chxj_config  *dconf;
 
-  dconf = (mod_chxj_config *)ap_get_module_config(r->per_dir_config, &chxj_module);
+  dconf = (mod_chxj_config *)chxj_get_module_config(r->per_dir_config, &chxj_module);
 
   rv = apr_file_open(&file, 
                      chxj_cookie_expire_db_lock_name_create(r, dconf->cookie_db_dir),
index 44fca4b..653adaf 100644 (file)
@@ -39,7 +39,7 @@ chxj_encoding(request_rec *r, const char* src, apr_size_t* len)
 
   DBG(r,"start chxj_encoding()");
 
-  dconf = ap_get_module_config(r->per_dir_config, &chxj_module);
+  dconf = chxj_get_module_config(r->per_dir_config, &chxj_module);
 
   if (dconf == NULL) {
     DBG(r,"none encoding.");
@@ -124,7 +124,7 @@ chxj_rencoding(request_rec *r, const char* src, apr_size_t* len)
 
   DBG(r,"start chxj_rencoding()");
 
-  dconf = ap_get_module_config(r->per_dir_config, &chxj_module);
+  dconf = chxj_get_module_config(r->per_dir_config, &chxj_module);
   if (! dconf) {
     DBG(r,"none encoding.");
     DBG(r,"end   chxj_rencoding()");
index 9220437..3f2bdaf 100644 (file)
@@ -367,7 +367,7 @@ chxj_exchange_hdml(
 
   hdml.entryp = entryp;
 
-  ap_set_content_type(r, "text/x-hdml; charset=Shift_JIS");
+  chxj_set_content_type(r, "text/x-hdml; charset=Shift_JIS");
   /*--------------------------------------------------------------------------*/
   /* DEBUG                                                                    */
   /*--------------------------------------------------------------------------*/
@@ -477,7 +477,7 @@ s_init_hdml(hdml_t* hdml, Doc* doc, request_rec* r, device_table* spec)
   hdml->doc      = doc;
   hdml->card     = qs_alloc_zero_byte_string(r);
   hdml->spec     = spec;
-  hdml->conf     = ap_get_module_config(r->per_dir_config, &chxj_module);
+  hdml->conf     = chxj_get_module_config(r->per_dir_config, &chxj_module);
   hdml->doc->parse_mode = PARSE_MODE_CHTML;
 
   for (ii=0; ii<MAX_FORM_COUNT; ii++) {
@@ -1549,7 +1549,7 @@ s_hdml_do_input_text_tag(hdml_t* hdml, Node* tag)
                                        "%s%02d=%s", 
                                        s_get_form_no(r, hdml),
                                        hdml->var_cnt[hdml->pure_form_cnt],
-                                       ap_escape_uri(r->pool,val)));
+                                       chxj_escape_uri(r->pool,val)));
   else 
     s_output_to_init_vars(hdml, 
                           apr_psprintf(r->pool, 
@@ -1650,7 +1650,7 @@ s_hdml_do_input_password_tag(hdml_t* hdml, Node* tag)
                     apr_psprintf(r->pool, "%s%02d=%s", 
                         s_get_form_no(r, hdml),
                         hdml->var_cnt[hdml->pure_form_cnt], 
-                        ap_escape_uri(r->pool,val)));
+                        chxj_escape_uri(r->pool,val)));
   else 
     s_output_to_init_vars(hdml, 
                     apr_psprintf(r->pool, "%s%02d=", 
@@ -1692,7 +1692,7 @@ s_hdml_do_input_submit_tag(hdml_t* hdml, Node* tag)
     s_output_to_hdml_out(hdml, 
                     apr_psprintf(r->pool, "VARS=\"%s=%s\" ", 
                             nm, 
-                            ap_escape_uri(r->pool,val)));
+                            chxj_escape_uri(r->pool,val)));
     if (strstr(hdml->postdata[hdml->pure_form_cnt], nm) == NULL) {
       s_output_to_postdata(hdml, 
                       apr_psprintf(r->pool,"%s%s=$%s", 
@@ -1730,7 +1730,7 @@ s_hdml_do_input_hidden_tag(hdml_t* hdml, Node* tag)
                     apr_psprintf(r->pool, 
                             "%s=%s", 
                             nm, 
-                            ap_escape_uri(r->pool, val)));
+                            chxj_escape_uri(r->pool, val)));
   }
 }
 
@@ -1971,7 +1971,7 @@ s_hdml_do_input_checkbox_tag(hdml_t* hdml, Node* tag)
                             hdml->var_cnt[hdml->pure_form_cnt] + 0,
                             s_get_form_no(r, hdml),
                             hdml->var_cnt[hdml->pure_form_cnt] + 1,
-                            ap_escape_uri(r->pool,val),
+                            chxj_escape_uri(r->pool,val),
                             s_get_form_no(r, hdml),
                             hdml->var_cnt[hdml->pure_form_cnt] + 2
                             ));
index 0ea6d7a..2abf2f0 100644 (file)
@@ -249,7 +249,7 @@ chxj_img_conv_format_handler(request_rec* r)
   }
 
   qsp = s_get_query_string_param(r);
-  conf = ap_get_module_config(r->per_dir_config, &chxj_module);
+  conf = chxj_get_module_config(r->per_dir_config, &chxj_module);
   if (conf == NULL) {
     DBG(r, "end chxj_img_conv_format_handler() conf is null");
     return DECLINED;
@@ -323,7 +323,7 @@ chxj_exchange_image(request_rec *r, const char** src, apr_size_t* len)
 
 
   qsp = s_get_query_string_param(r);
-  conf = ap_get_module_config(r->per_dir_config, &chxj_module);
+  conf = chxj_get_module_config(r->per_dir_config, &chxj_module);
   if (conf == NULL) {
     DBG(r, "end chxj_exchange_image()");
     return NULL;
@@ -1278,7 +1278,7 @@ s_fixup_depth(MagickWand* magick_wand, request_rec* r, device_table* spec)
 static MagickWand*
 s_add_copyright(MagickWand* magick_wand, request_rec* r, device_table* spec)
 {
-  mod_chxj_config* conf = ap_get_module_config(r->per_dir_config, &chxj_module);
+  mod_chxj_config* conf = chxj_get_module_config(r->per_dir_config, &chxj_module);
 
   if (spec->html_spec_type == CHXJ_SPEC_UNKNOWN) {
     DBG(r, "Pass add_copiright proc");
@@ -1497,40 +1497,40 @@ s_send_cache_file(device_table* spec, query_string_param_t* query_string, reques
     name[strlen(name)-4] = 0;
     if (strcasecmp(r->content_type, "image/jpeg") == 0) {
 
-      ap_set_content_type(r, "text/x-hdml; charset=Shift_JIS");
+      chxj_set_content_type(r, "text/x-hdml; charset=Shift_JIS");
       ap_rprintf(r, HDML_FIRST_PAGE, r->uri, name, ".jpg", (long)st.size, "devjaww", name);
     }
     else
     if (strcasecmp(r->content_type, "image/bmp") == 0) {
-      ap_set_content_type(r, "text/x-hdml; charset=Shift_JIS");
+      chxj_set_content_type(r, "text/x-hdml; charset=Shift_JIS");
       ap_rprintf(r, HDML_FIRST_PAGE, r->uri, name, ".bmp", (long)st.size, "devabm", name);
     }
     else
     if (strcasecmp(r->content_type, "image/png") == 0) {
-      ap_set_content_type(r, "text/x-hdml; charset=Shift_JIS");
+      chxj_set_content_type(r, "text/x-hdml; charset=Shift_JIS");
       ap_rprintf(r, HDML_FIRST_PAGE, r->uri, name, ".png", (long)st.size, "dev8aww", name);
     }
     else
     if (strcasecmp(r->content_type, "image/gif") == 0) {
-      ap_set_content_type(r, "text/x-hdml; charset=Shift_JIS");
+      chxj_set_content_type(r, "text/x-hdml; charset=Shift_JIS");
       ap_rprintf(r, HDML_FIRST_PAGE, r->uri, name, ".gif", (long)st.size, "devgi0z", name);
     }
   }
   else
   if (query_string->mode == IMG_CONV_MODE_WALLPAPER && query_string->name != NULL) {
     if (query_string->count == -1 && query_string->offset == -1) {
-      ap_set_content_type(r, "text/x-hdml; charset=Shift_JIS");
+      chxj_set_content_type(r, "text/x-hdml; charset=Shift_JIS");
       ap_rprintf(r, HDML_SUCCESS_PAGE);
       ap_rflush(r);
     }
     else
     if (query_string->count == -2 && query_string->offset == -1) {
-      ap_set_content_type(r, "text/x-hdml; charset=Shift_JIS");
+      chxj_set_content_type(r, "text/x-hdml; charset=Shift_JIS");
       ap_rprintf(r, HDML_FAIL_PAGE);
       ap_rflush(r);
     }
     else { 
-      ap_set_content_type(r, "application/x-up-download");
+      chxj_set_content_type(r, "application/x-up-download");
       contentLength = apr_psprintf(r->pool, "%ld", query_string->count);
       apr_table_setn(r->headers_out, "Content-Length", (const char*)contentLength);
   
@@ -1626,32 +1626,32 @@ s_header_only_cache_file(device_table* spec, query_string_param_t* query_string,
     name[strlen(name)-4] = 0;
     if (strcasecmp(r->content_type, "image/jpeg") == 0) {
 
-      ap_set_content_type(r, "text/x-hdml; charset=Shift_JIS");
+      chxj_set_content_type(r, "text/x-hdml; charset=Shift_JIS");
     }
     else
     if (strcasecmp(r->content_type, "image/bmp") == 0) {
-      ap_set_content_type(r, "text/x-hdml; charset=Shift_JIS");
+      chxj_set_content_type(r, "text/x-hdml; charset=Shift_JIS");
     }
     else
     if (strcasecmp(r->content_type, "image/png") == 0) {
-      ap_set_content_type(r, "text/x-hdml; charset=Shift_JIS");
+      chxj_set_content_type(r, "text/x-hdml; charset=Shift_JIS");
     }
     else
     if (strcasecmp(r->content_type, "image/gif") == 0) {
-      ap_set_content_type(r, "text/x-hdml; charset=Shift_JIS");
+      chxj_set_content_type(r, "text/x-hdml; charset=Shift_JIS");
     }
   }
   else
   if (query_string->mode == IMG_CONV_MODE_WALLPAPER && query_string->name != NULL) {
     if (query_string->count == -1 && query_string->offset == -1) {
-      ap_set_content_type(r, "text/x-hdml; charset=Shift_JIS");
+      chxj_set_content_type(r, "text/x-hdml; charset=Shift_JIS");
     }
     else
     if (query_string->count == -2 && query_string->offset == -1) {
-      ap_set_content_type(r, "text/x-hdml; charset=Shift_JIS");
+      chxj_set_content_type(r, "text/x-hdml; charset=Shift_JIS");
     }
     else { 
-      ap_set_content_type(r, "application/x-up-download");
+      chxj_set_content_type(r, "application/x-up-download");
       contentLength = apr_psprintf(r->pool, "%ld", query_string->count);
       apr_table_setn(r->headers_out, "Content-Length", (const char*)contentLength);
   
@@ -1797,7 +1797,7 @@ chxj_trans_name(request_rec *r)
 
   DBG(r, "start chxj_trans_name()");
 
-  conf = ap_get_module_config(r->per_dir_config, &chxj_module);
+  conf = chxj_get_module_config(r->per_dir_config, &chxj_module);
 
   if (conf == NULL) {
     DBG(r, "end chxj_trans_name() conf is null[%s]", r->uri);
index af131af..8ac34f8 100644 (file)
@@ -364,7 +364,7 @@ chxj_exchange_jhtml(
   jhtml.entryp = entryp;
   jhtml.cookie = cookie;
 
-  ap_set_content_type(r, "text/html; charset=Windows-31J");
+  chxj_set_content_type(r, "text/html; charset=Windows-31J");
 
   /*--------------------------------------------------------------------------*/
   /* The character string of the input is analyzed.                           */
@@ -431,7 +431,7 @@ s_init_jhtml(jhtml_t* jhtml, Doc* doc, request_rec* r, device_table* spec)
   jhtml->doc  = doc;
   jhtml->spec = spec;
   jhtml->out  = qs_alloc_zero_byte_string(r);
-  jhtml->conf = ap_get_module_config(r->per_dir_config, &chxj_module);
+  jhtml->conf = chxj_get_module_config(r->per_dir_config, &chxj_module);
   jhtml->doc->parse_mode = PARSE_MODE_CHTML;
 }
 
index d01b0f1..a324ea8 100644 (file)
@@ -601,7 +601,7 @@ chxj_qr_code_handler(request_rec* r)
   /*--------------------------------------------------------------------------*/
   /* ¤â¤·¡¢¥¤¥á¡¼¥¸ÊÑ´¹¥Ï¥ó¥É¥éÃæ¤Ç¤¢¤ì¤Ð¡¢¤³¤³¤Ç¤Ï½èÍý¤·¤Ê¤¤                 */
   /*--------------------------------------------------------------------------*/
-  conf = ap_get_module_config(r->per_dir_config, &chxj_module);
+  conf = chxj_get_module_config(r->per_dir_config, &chxj_module);
   if (!conf || conf->image == CHXJ_IMG_ON)
     return DECLINED;
 
@@ -627,7 +627,7 @@ chxj_qr_code_handler(request_rec* r)
   if (sts != OK)
     return sts;
 
-  ap_set_content_type(r, "image/jpg");
+  chxj_set_content_type(r, "image/jpg");
 
   ap_rwrite((void*)img, len, r);
 
@@ -669,7 +669,7 @@ chxj_qr_code_blob_handler(request_rec* r, const char* indata, size_t* len)
     return NULL;
   }
 
-  ap_set_content_type(r, "image/jpg");
+  chxj_set_content_type(r, "image/jpg");
 
   DBG(r, "end chxj_qr_code_blob_handler()");
 
index af407e8..a29b71a 100644 (file)
@@ -80,7 +80,7 @@ chxj_specified_device(request_rec* r, const char* user_agent)
 
   DBG(r, "start chxj_specified_device()");
 
-  conf = ap_get_module_config(r->per_dir_config, &chxj_module);
+  conf = chxj_get_module_config(r->per_dir_config, &chxj_module);
   if (! conf->devices) {
     DBG(r, "device_data.xml load failure");
     return returnType;
index 282e070..136c103 100644 (file)
@@ -370,7 +370,7 @@ chxj_exchange_xhtml_mobile_1_0(
 
   xhtml.entryp = entryp;
 
-  ap_set_content_type(r, "text/html; charset=Windows-31J");
+  chxj_set_content_type(r, "text/html; charset=Windows-31J");
 
   /*--------------------------------------------------------------------------*/
   /* The character string of the input is analyzed.                           */
@@ -435,7 +435,7 @@ s_init_xhtml(xhtml_t* xhtml, Doc* doc, request_rec* r, device_table* spec)
   xhtml->doc  = doc;
   xhtml->spec = spec;
   xhtml->out  = qs_alloc_zero_byte_string(r);
-  xhtml->conf = ap_get_module_config(r->per_dir_config, &chxj_module);
+  xhtml->conf = chxj_get_module_config(r->per_dir_config, &chxj_module);
   xhtml->doc->parse_mode = PARSE_MODE_CHTML;
 }
 
index a1bba8d..c20def5 100644 (file)
@@ -138,7 +138,7 @@ chxj_headers_fixup(request_rec *r)
   device_table*       spec;
 
   DBG(r, "start chxj_headers_fixup()");
-  dconf = ap_get_module_config(r->per_dir_config, &chxj_module);
+  dconf = chxj_get_module_config(r->per_dir_config, &chxj_module);
 
   user_agent = (char*)apr_table_get(r->headers_in, HTTP_USER_AGENT);
   spec = chxj_specified_device(r, user_agent);
@@ -202,7 +202,7 @@ chxj_exchange(request_rec *r, const char** src, apr_size_t* len, device_table *s
   DBG(r,"start of chxj_exchange() input:[%.*s]", (int)*len, *src);
   dst  = apr_pstrcat(r->pool, (char*)*src, NULL);
 
-  dconf = ap_get_module_config(r->per_dir_config, &chxj_module);
+  dconf = chxj_get_module_config(r->per_dir_config, &chxj_module);
 
 
   entryp = chxj_apply_convrule(r, dconf->convrules);
@@ -668,7 +668,7 @@ chxj_output_filter(ap_filter_t *f, apr_bucket_brigade *bb)
     return APR_SUCCESS;
   }
 
-  dconf      = ap_get_module_config(r->per_dir_config, &chxj_module);
+  dconf      = chxj_get_module_config(r->per_dir_config, &chxj_module);
   user_agent = (char*)apr_table_get(r->headers_in, HTTP_USER_AGENT);
   if (ctx && ctx->entryp) entryp = ctx->entryp;
   else                    entryp = chxj_apply_convrule(r, dconf->convrules);
@@ -1005,7 +1005,7 @@ chxj_input_filter(ap_filter_t*        f,
     return ap_get_brigade(f->next, bb, mode, block, readbytes);
   }
 
-  dconf = ap_get_module_config(r->per_dir_config, &chxj_module);
+  dconf = chxj_get_module_config(r->per_dir_config, &chxj_module);
   user_agent = (char*)apr_table_get(r->headers_in, "User-Agent");
 
   if (ctx && ctx->entryp) entryp = ctx->entryp;
@@ -1267,7 +1267,7 @@ chxj_insert_filter(request_rec *r)
   chxjconvrule_entry* entryp;
 DBG(r, "start chxj_insert_filter()");
 
-  dconf = ap_get_module_config(r->per_dir_config, &chxj_module);
+  dconf = chxj_get_module_config(r->per_dir_config, &chxj_module);
 
   user_agent = (char*)apr_table_get(r->headers_in, HTTP_USER_AGENT);
   spec = chxj_specified_device(r, user_agent);
index 0b531ab..d1e292c 100644 (file)
@@ -18,7 +18,7 @@
 #include <unistd.h>
 #include "qs_log.h"
 #include "qs_malloc.h"
-#include "http_log.h"
+#include "chxj_apache.h"
 
 
 
@@ -80,7 +80,7 @@ qs_log(Doc* doc, int log_level,const char* f, int l, char* msg)
     while(0);
 #endif
     if (doc->r) {
-      ap_log_rerror(f,l, APLOG_CRIT, 0, doc->r, msg);
+      chxj_log_rerror(f,l, APLOG_CRIT, 0, doc->r, msg);
     }
     qs_all_free(doc, QX_LOGMARK);
     _exit(0);
index 6971977..031a307 100644 (file)
@@ -17,8 +17,8 @@
 #include <stdio.h>
 #include <strings.h>
 #include <stdlib.h>
-#include "httpd.h"
-#include "http_log.h"
+
+#include "chxj_apache.h"
 #include "qs_parse_string.h"
 #include "qs_parse_tag.h"
 #include "qs_log.h"
diff --git a/test/chxj_chtml10/.tb.Makefile.tags b/test/chxj_chtml10/.tb.Makefile.tags
new file mode 100644 (file)
index 0000000..a03b487
--- /dev/null
@@ -0,0 +1,9 @@
+!_TAG_FILE_FORMAT      2       /extended format; --format=1 will not append ;" to lines/
+!_TAG_FILE_SORTED      1       /0=unsorted, 1=sorted, 2=foldcase/
+!_TAG_PROGRAM_AUTHOR   Darren Hiebert  /dhiebert@users.sourceforge.net/
+!_TAG_PROGRAM_NAME     Exuberant Ctags //
+!_TAG_PROGRAM_URL      http://ctags.sourceforge.net    /official site/
+!_TAG_PROGRAM_VERSION  5.6     //
+INC_DIR        /home/konno/work/mod_chxj/mod_chxj/test/chxj_chtml10/Makefile   /^INC_DIR=-I$(TOP_DIR)\/include \\$/;"  macro   line:8
+TARGET /home/konno/work/mod_chxj/mod_chxj/test/chxj_chtml10/Makefile   /^TARGET= test_chxj_chtml10$/;" macro   line:4
+TOP_DIR        /home/konno/work/mod_chxj/mod_chxj/test/chxj_chtml10/Makefile   /^TOP_DIR=..\/..$/;"    macro   line:6
diff --git a/test/chxj_chtml10/.tb.test_chxj_chtml10.c.tags b/test/chxj_chtml10/.tb.test_chxj_chtml10.c.tags
new file mode 100644 (file)
index 0000000..5dfddc1
--- /dev/null
@@ -0,0 +1,26 @@
+!_TAG_FILE_FORMAT      2       /extended format; --format=1 will not append ;" to lines/
+!_TAG_FILE_SORTED      1       /0=unsorted, 1=sorted, 2=foldcase/
+!_TAG_PROGRAM_AUTHOR   Darren Hiebert  /dhiebert@users.sourceforge.net/
+!_TAG_PROGRAM_NAME     Exuberant Ctags //
+!_TAG_PROGRAM_URL      http://ctags.sourceforge.net    /official site/
+!_TAG_PROGRAM_VERSION  5.6     //
+APR_INIT       /home/konno/work/mod_chxj/mod_chxj/test/chxj_chtml10/test_chxj_chtml10.c        91;"    macro   line:91
+APR_TERM       /home/konno/work/mod_chxj/mod_chxj/test/chxj_chtml10/test_chxj_chtml10.c        101;"   macro   line:101
+CHXJ_TEST      /home/konno/work/mod_chxj/mod_chxj/test/chxj_chtml10/test_chxj_chtml10.c        5;"     macro   line:5
+COOKIE_INIT    /home/konno/work/mod_chxj/mod_chxj/test/chxj_chtml10/test_chxj_chtml10.c        106;"   macro   line:106
+SPEC_INIT      /home/konno/work/mod_chxj/mod_chxj/test/chxj_chtml10/test_chxj_chtml10.c        111;"   macro   line:111
+TEST_STRING    /home/konno/work/mod_chxj/mod_chxj/test/chxj_chtml10/test_chxj_chtml10.c        133;"   macro   line:133
+TEST_STRING    /home/konno/work/mod_chxj/mod_chxj/test/chxj_chtml10/test_chxj_chtml10.c        150;"   macro   line:150
+TEST_STRING    /home/konno/work/mod_chxj/mod_chxj/test/chxj_chtml10/test_chxj_chtml10.c        154;"   macro   line:154
+TEST_STRING    /home/konno/work/mod_chxj/mod_chxj/test/chxj_chtml10/test_chxj_chtml10.c        171;"   macro   line:171
+chxj_apply_convrule    /home/konno/work/mod_chxj/mod_chxj/test/chxj_chtml10/test_chxj_chtml10.c        /^chxj_apply_convrule(request_rec* r, apr_array_header_t* convrules)$/;"        function        line:85
+chxj_qr_code_blob_handler      /home/konno/work/mod_chxj/mod_chxj/test/chxj_chtml10/test_chxj_chtml10.c        /^char *chxj_qr_code_blob_handler(request_rec* r, const char* indata, size_t* len)$/;"  function        line:58
+main   /home/konno/work/mod_chxj/mod_chxj/test/chxj_chtml10/test_chxj_chtml10.c        /^main()$/;"    function        line:117
+test_chtml10_001       /home/konno/work/mod_chxj/mod_chxj/test/chxj_chtml10/test_chxj_chtml10.c        /^void test_chtml10_001() $/;"  function        line:131
+test_chtml10_002       /home/konno/work/mod_chxj/mod_chxj/test/chxj_chtml10/test_chxj_chtml10.c        /^void test_chtml10_002() $/;"  function        line:152
+test_get_module_config /home/konno/work/mod_chxj/mod_chxj/test/chxj_chtml10/test_chxj_chtml10.c        /^void * test_get_module_config(const ap_conf_vector_t *cv, const module *m)$/;"        function        line:79
+test_log_error /home/konno/work/mod_chxj/mod_chxj/test/chxj_chtml10/test_chxj_chtml10.c        /^void test_log_error(const char *file, int line, int level, apr_status_t status, const request_rec *r, const char *fmt, ...)$/;"       function        line:48
+test_log_rerror        /home/konno/work/mod_chxj/mod_chxj/test/chxj_chtml10/test_chxj_chtml10.c        /^void test_log_rerror(const char *file, int line, int level, apr_status_t status, const request_rec *r, const char *fmt, ...)$/;"      function        line:39
+test_os_escape_path    /home/konno/work/mod_chxj/mod_chxj/test/chxj_chtml10/test_chxj_chtml10.c        /^char *test_os_escape_path(apr_pool_t *p, const char *path, int partial)$/;"   function        line:63
+test_run_http_scheme   /home/konno/work/mod_chxj/mod_chxj/test/chxj_chtml10/test_chxj_chtml10.c        /^const char *test_run_http_scheme(request_rec *r)$/;"  function        line:73
+test_set_content_type  /home/konno/work/mod_chxj/mod_chxj/test/chxj_chtml10/test_chxj_chtml10.c        /^void test_set_content_type(request_rec *r, const char *ct)$/;"        function        line:68
diff --git a/test/chxj_chtml10/Makefile b/test/chxj_chtml10/Makefile
new file mode 100644 (file)
index 0000000..5467d1a
--- /dev/null
@@ -0,0 +1,25 @@
+.SUFFIXES:
+.SUFFIXES: .c.o
+
+TARGET= test_chxj_chtml10
+
+TOP_DIR=../..
+
+INC_DIR=-I$(TOP_DIR)/include \
+  -I/usr/include/apache2 \
+  -I/usr/include/apr-1.0 \
+  -I$(TOP_DIR)/src
+
+all:test
+
+
+
+test: $(TARGET)
+       ./$(TARGET)
+
+$(TARGET): $(TARGET).c
+       gcc -g -o $@ -Wall -lcunit $< $(INC_DIR) -DLINUX=2 -D_REENTRANT -D_GNU_SOURCE -D_LARGEFILE64_SOURCE  -lapr-1 -laprutil-1 
+
+
+clean:
+       rm -f ./$(TARGET)
diff --git a/test/chxj_chtml10/erer b/test/chxj_chtml10/erer
new file mode 100644 (file)
index 0000000..6b0731a
--- /dev/null
@@ -0,0 +1,1461 @@
+# 1 "/usr/include/apache2/http_protocol.h"
+# 1 "<built-in>"
+# 1 "<command line>"
+# 1 "/usr/include/apache2/http_protocol.h"
+# 29 "/usr/include/apache2/http_protocol.h"
+# 1 "/usr/include/apache2/httpd.h" 1
+# 43 "/usr/include/apache2/httpd.h"
+# 1 "/usr/include/apache2/ap_config.h" 1
+# 232 "/usr/include/apache2/ap_config.h"
+# 1 "/usr/include/apache2/os.h" 1
+# 32 "/usr/include/apache2/os.h"
+# 1 "/usr/include/apache2/ap_config.h" 1
+# 33 "/usr/include/apache2/os.h" 2
+# 233 "/usr/include/apache2/ap_config.h" 2
+
+# 1 "/usr/include/apache2/ap_config_auto.h" 1
+# 235 "/usr/include/apache2/ap_config.h" 2
+# 1 "/usr/include/apache2/ap_config_layout.h" 1
+# 236 "/usr/include/apache2/ap_config.h" 2
+# 44 "/usr/include/apache2/httpd.h" 2
+# 1 "/usr/include/apache2/ap_mmn.h" 1
+# 45 "/usr/include/apache2/httpd.h" 2
+
+# 1 "/usr/include/apache2/ap_release.h" 1
+# 47 "/usr/include/apache2/httpd.h" 2
+# 59 "/usr/include/apache2/httpd.h"
+# 1 "/usr/include/apache2/ap_regex.h" 1
+# 77 "/usr/include/apache2/ap_regex.h"
+enum {
+  AP_REG_ASSERT = 1,
+  AP_REG_ESPACE,
+  AP_REG_INVARG,
+  AP_REG_NOMATCH
+};
+
+
+typedef struct {
+    void *re_pcre;
+    apr_size_t re_nsub;
+    apr_size_t re_erroffset;
+} ap_regex_t;
+
+
+typedef struct {
+    int rm_so;
+    int rm_eo;
+} ap_regmatch_t;
+# 106 "/usr/include/apache2/ap_regex.h"
+int ap_regcomp(ap_regex_t *preg, const char *regex, int cflags);
+# 117 "/usr/include/apache2/ap_regex.h"
+int ap_regexec(const ap_regex_t *preg, const char *string,
+                           apr_size_t nmatch, ap_regmatch_t *pmatch, int eflags);
+# 127 "/usr/include/apache2/ap_regex.h"
+apr_size_t ap_regerror(int errcode, const ap_regex_t *preg,
+                                   char *errbuf, apr_size_t errbuf_size);
+
+
+
+
+void ap_regfree(ap_regex_t *preg);
+# 60 "/usr/include/apache2/httpd.h" 2
+# 407 "/usr/include/apache2/httpd.h"
+typedef struct {
+    int major;
+    int minor;
+    int patch;
+    const char *add_string;
+} ap_version_t;
+
+
+
+
+
+
+
+void ap_get_server_revision(ap_version_t *version);
+
+
+
+
+
+const char * ap_get_server_version(void);
+
+
+
+
+
+
+void ap_add_version_component(apr_pool_t *pconf, const char *component);
+
+
+
+
+
+const char * ap_get_server_built(void);
+# 590 "/usr/include/apache2/httpd.h"
+typedef struct ap_method_list_t ap_method_list_t;
+# 599 "/usr/include/apache2/httpd.h"
+struct ap_method_list_t {
+
+    apr_int64_t method_mask;
+
+    apr_array_header_t *method_list;
+};
+# 689 "/usr/include/apache2/httpd.h"
+struct htaccess_result {
+
+    const char *dir;
+
+    int override;
+
+    int override_opts;
+
+    struct ap_conf_vector_t *htaccess;
+
+    const struct htaccess_result *next;
+};
+# 711 "/usr/include/apache2/httpd.h"
+typedef struct process_rec process_rec;
+
+typedef struct server_rec server_rec;
+
+typedef struct conn_rec conn_rec;
+
+typedef struct request_rec request_rec;
+
+typedef struct conn_state_t conn_state_t;
+# 728 "/usr/include/apache2/httpd.h"
+struct process_rec {
+
+    apr_pool_t *pool;
+
+    apr_pool_t *pconf;
+
+    int argc;
+
+    const char * const *argv;
+
+    const char *short_name;
+};
+
+
+
+
+struct request_rec {
+
+    apr_pool_t *pool;
+
+    conn_rec *connection;
+
+    server_rec *server;
+
+
+    request_rec *next;
+
+    request_rec *prev;
+
+
+
+    request_rec *main;
+
+
+
+
+
+    char *the_request;
+
+    int assbackwards;
+
+
+
+
+    int proxyreq;
+
+    int header_only;
+
+    char *protocol;
+
+    int proto_num;
+
+    const char *hostname;
+
+
+    apr_time_t request_time;
+
+
+    const char *status_line;
+
+    int status;
+
+
+
+
+
+
+    const char *method;
+
+    int method_number;
+# 819 "/usr/include/apache2/httpd.h"
+    apr_int64_t allowed;
+
+    apr_array_header_t *allowed_xmethods;
+
+    ap_method_list_t *allowed_methods;
+
+
+    apr_off_t sent_bodyct;
+
+    apr_off_t bytes_sent;
+
+    apr_time_t mtime;
+
+
+
+
+    int chunked;
+
+    const char *range;
+
+    apr_off_t clength;
+
+
+    apr_off_t remaining;
+
+    apr_off_t read_length;
+
+
+
+    int read_body;
+
+    int read_chunked;
+
+    unsigned expecting_100;
+# 867 "/usr/include/apache2/httpd.h"
+    apr_table_t *headers_in;
+
+    apr_table_t *headers_out;
+
+
+    apr_table_t *err_headers_out;
+
+    apr_table_t *subprocess_env;
+
+    apr_table_t *notes;
+
+
+
+
+
+
+    const char *content_type;
+
+    const char *handler;
+
+
+    const char *content_encoding;
+
+    apr_array_header_t *content_languages;
+
+
+    char *vlist_validator;
+
+
+    char *user;
+
+    char *ap_auth_type;
+
+
+    int no_cache;
+
+    int no_local_copy;
+
+
+
+
+
+
+    char *unparsed_uri;
+
+    char *uri;
+
+    char *filename;
+
+
+    char *canonical_filename;
+
+    char *path_info;
+
+    char *args;
+
+    apr_finfo_t finfo;
+
+    apr_uri_t parsed_uri;
+# 935 "/usr/include/apache2/httpd.h"
+    int used_path_info;
+
+
+
+
+
+
+
+    struct ap_conf_vector_t *per_dir_config;
+
+    struct ap_conf_vector_t *request_config;
+
+
+
+
+
+
+
+    const struct htaccess_result *htaccess;
+
+
+    struct ap_filter_t *output_filters;
+
+    struct ap_filter_t *input_filters;
+
+
+
+    struct ap_filter_t *proto_output_filters;
+
+
+    struct ap_filter_t *proto_input_filters;
+
+
+    int eos_sent;
+
+
+
+
+
+
+};
+# 997 "/usr/include/apache2/httpd.h"
+typedef enum {
+    AP_CONN_UNKNOWN,
+    AP_CONN_CLOSE,
+    AP_CONN_KEEPALIVE
+} ap_conn_keepalive_e;
+
+
+
+
+struct conn_rec {
+
+    apr_pool_t *pool;
+
+    server_rec *base_server;
+
+    void *vhost_lookup_data;
+
+
+
+    apr_sockaddr_t *local_addr;
+
+    apr_sockaddr_t *remote_addr;
+
+
+    char *remote_ip;
+
+
+
+    char *remote_host;
+
+
+    char *remote_logname;
+
+
+    unsigned aborted:1;
+
+
+
+    ap_conn_keepalive_e keepalive;
+
+
+
+    signed int double_reverse:2;
+
+
+    int keepalives;
+
+    char *local_ip;
+
+
+    char *local_host;
+
+
+    long id;
+
+
+    struct ap_conf_vector_t *conn_config;
+
+
+    apr_table_t *notes;
+
+    struct ap_filter_t *input_filters;
+
+    struct ap_filter_t *output_filters;
+
+    void *sbh;
+
+    struct apr_bucket_alloc_t *bucket_alloc;
+
+    conn_state_t *cs;
+
+    int data_in_input_filters;
+};
+
+
+
+
+typedef enum {
+    CONN_STATE_CHECK_REQUEST_LINE_READABLE,
+    CONN_STATE_READ_REQUEST_LINE,
+    CONN_STATE_LINGER
+} conn_state_e;
+
+
+
+
+struct conn_state_t {
+
+    APR_RING_ENTRY(conn_state_t) timeout_list;
+
+    apr_time_t expiration_time;
+
+    conn_state_e state;
+
+    conn_rec *c;
+
+    apr_pool_t *p;
+
+    apr_bucket_alloc_t *bucket_alloc;
+
+    apr_pollfd_t pfd;
+};
+# 1113 "/usr/include/apache2/httpd.h"
+typedef struct server_addr_rec server_addr_rec;
+struct server_addr_rec {
+
+    server_addr_rec *next;
+
+    apr_sockaddr_t *host_addr;
+
+    apr_port_t host_port;
+
+    char *virthost;
+};
+
+
+
+
+struct server_rec {
+
+    process_rec *process;
+
+    server_rec *next;
+
+
+    const char *defn_name;
+
+    unsigned defn_line_number;
+
+
+
+
+    char *server_admin;
+
+    char *server_hostname;
+
+    apr_port_t port;
+
+
+
+
+    char *error_fname;
+
+    apr_file_t *error_log;
+
+    int loglevel;
+
+
+
+
+    int is_virtual;
+
+
+    struct ap_conf_vector_t *module_config;
+
+    struct ap_conf_vector_t *lookup_defaults;
+
+
+
+
+    server_addr_rec *addrs;
+
+    apr_interval_time_t timeout;
+
+    apr_interval_time_t keep_alive_timeout;
+
+    int keep_alive_max;
+
+    int keep_alive;
+
+
+    const char *path;
+
+    int pathlen;
+
+
+    apr_array_header_t *names;
+
+    apr_array_header_t *wild_names;
+
+
+    int limit_req_line;
+
+    int limit_req_fieldsize;
+
+    int limit_req_fields;
+
+
+    const char *server_scheme;
+};
+
+typedef struct core_output_filter_ctx {
+    apr_bucket_brigade *b;
+
+
+
+    apr_pool_t *deferred_write_pool;
+} core_output_filter_ctx_t;
+
+typedef struct core_filter_ctx {
+    apr_bucket_brigade *b;
+    apr_bucket_brigade *tmpbb;
+} core_ctx_t;
+
+typedef struct core_net_rec {
+
+    apr_socket_t *client_socket;
+
+
+    conn_rec *c;
+
+    core_output_filter_ctx_t *out_ctx;
+    core_ctx_t *in_ctx;
+} core_net_rec;
+# 1232 "/usr/include/apache2/httpd.h"
+char * ap_field_noparam(apr_pool_t *p, const char *intype);
+# 1242 "/usr/include/apache2/httpd.h"
+char * ap_ht_time(apr_pool_t *p, apr_time_t t, const char *fmt, int gmt);
+# 1255 "/usr/include/apache2/httpd.h"
+char * ap_getword(apr_pool_t *p, const char **line, char stop);
+# 1265 "/usr/include/apache2/httpd.h"
+char * ap_getword_nc(apr_pool_t *p, char **line, char stop);
+# 1274 "/usr/include/apache2/httpd.h"
+char * ap_getword_white(apr_pool_t *p, const char **line);
+# 1284 "/usr/include/apache2/httpd.h"
+char * ap_getword_white_nc(apr_pool_t *p, char **line);
+# 1294 "/usr/include/apache2/httpd.h"
+char * ap_getword_nulls(apr_pool_t *p, const char **line,
+        char stop);
+# 1306 "/usr/include/apache2/httpd.h"
+char * ap_getword_nulls_nc(apr_pool_t *p, char **line, char stop);
+
+
+
+
+
+
+
+char * ap_getword_conf(apr_pool_t *p, const char **line);
+# 1323 "/usr/include/apache2/httpd.h"
+char * ap_getword_conf_nc(apr_pool_t *p, char **line);
+# 1334 "/usr/include/apache2/httpd.h"
+const char * ap_resolve_env(apr_pool_t *p, const char * word);
+# 1345 "/usr/include/apache2/httpd.h"
+const char * ap_size_list_item(const char **field, int *len);
+# 1357 "/usr/include/apache2/httpd.h"
+char * ap_get_list_item(apr_pool_t *p, const char **field);
+# 1367 "/usr/include/apache2/httpd.h"
+int ap_find_list_item(apr_pool_t *p, const char *line, const char *tok);
+# 1379 "/usr/include/apache2/httpd.h"
+char * ap_get_token(apr_pool_t *p, const char **accept_line, int accept_white);
+# 1388 "/usr/include/apache2/httpd.h"
+int ap_find_token(apr_pool_t *p, const char *line, const char *tok);
+# 1397 "/usr/include/apache2/httpd.h"
+int ap_find_last_token(apr_pool_t *p, const char *line, const char *tok);
+
+
+
+
+
+
+int ap_is_url(const char *u);
+
+
+
+
+
+
+int ap_unescape_url(char *url);
+
+
+
+
+
+
+int ap_unescape_url_keep2f(char *url);
+
+
+
+
+
+void ap_no2slash(char *name);
+
+
+
+
+
+
+void ap_getparents(char *name);
+
+
+
+
+
+
+
+char * ap_escape_path_segment(apr_pool_t *p, const char *s);
+# 1449 "/usr/include/apache2/httpd.h"
+char * ap_os_escape_path(apr_pool_t *p, const char *path, int partial);
+# 1460 "/usr/include/apache2/httpd.h"
+char * ap_escape_html(apr_pool_t *p, const char *s);
+
+
+
+
+
+
+
+char * ap_escape_logitem(apr_pool_t *p, const char *str);
+# 1477 "/usr/include/apache2/httpd.h"
+apr_size_t ap_escape_errorlog_item(char *dest, const char *source,
+                                               apr_size_t buflen);
+# 1488 "/usr/include/apache2/httpd.h"
+char * ap_construct_server(apr_pool_t *p, const char *hostname,
+        apr_port_t port, const request_rec *r);
+
+
+
+
+
+
+
+char * ap_escape_shell_cmd(apr_pool_t *p, const char *s);
+
+
+
+
+
+
+int ap_count_dirs(const char *path);
+# 1517 "/usr/include/apache2/httpd.h"
+char * ap_make_dirstr_prefix(char *d, const char *s, int n);
+# 1526 "/usr/include/apache2/httpd.h"
+char * ap_make_dirstr_parent(apr_pool_t *p, const char *s);
+# 1540 "/usr/include/apache2/httpd.h"
+char * ap_make_full_path(apr_pool_t *a, const char *dir, const char *f);
+# 1550 "/usr/include/apache2/httpd.h"
+int ap_os_is_path_absolute(apr_pool_t *p, const char *dir);
+# 1559 "/usr/include/apache2/httpd.h"
+int ap_is_matchexp(const char *str);
+
+
+
+
+
+
+
+int ap_strcmp_match(const char *str, const char *expected);
+# 1576 "/usr/include/apache2/httpd.h"
+int ap_strcasecmp_match(const char *str, const char *expected);
+# 1585 "/usr/include/apache2/httpd.h"
+char * ap_strcasestr(const char *s1, const char *s2);
+
+
+
+
+
+
+
+const char * ap_stripprefix(const char *bigstring,
+                                        const char *prefix);
+
+
+
+
+
+
+
+char * ap_pbase64decode(apr_pool_t *p, const char *bufcoded);
+
+
+
+
+
+
+
+char * ap_pbase64encode(apr_pool_t *p, char *string);
+# 1624 "/usr/include/apache2/httpd.h"
+ap_regex_t * ap_pregcomp(apr_pool_t *p, const char *pattern,
+                                     int cflags);
+
+
+
+
+
+
+void ap_pregfree(apr_pool_t *p, ap_regex_t *reg);
+# 1645 "/usr/include/apache2/httpd.h"
+char * ap_pregsub(apr_pool_t *p, const char *input, const char *source,
+                              size_t nmatch, ap_regmatch_t pmatch[]);
+
+
+
+
+
+
+void ap_content_type_tolower(char *s);
+
+
+
+
+
+void ap_str_tolower(char *s);
+# 1668 "/usr/include/apache2/httpd.h"
+int ap_ind(const char *str, char c);
+# 1677 "/usr/include/apache2/httpd.h"
+int ap_rind(const char *str, char c);
+
+
+
+
+
+
+
+char * ap_escape_quotes(apr_pool_t *p, const char *instring);
+# 1697 "/usr/include/apache2/httpd.h"
+char * ap_append_pid(apr_pool_t *p, const char *string,
+                                 const char *delim);
+# 1707 "/usr/include/apache2/httpd.h"
+int ap_is_rdirectory(apr_pool_t *p, const char *name);
+
+
+
+
+
+
+
+int ap_is_directory(apr_pool_t *p, const char *name);
+# 1726 "/usr/include/apache2/httpd.h"
+char *ap_get_local_host(apr_pool_t *p);
+
+
+
+
+
+
+
+void ap_log_assert(const char *szExp, const char *szFile, int nLine)
+       __attribute__((noreturn));
+# 1790 "/usr/include/apache2/httpd.h"
+const char * ap_psignature(const char *prefix, request_rec *r);
+# 1805 "/usr/include/apache2/httpd.h"
+# 1 "/usr/include/string.h" 1 3 4
+# 26 "/usr/include/string.h" 3 4
+# 1 "/usr/include/features.h" 1 3 4
+# 308 "/usr/include/features.h" 3 4
+# 1 "/usr/include/sys/cdefs.h" 1 3 4
+# 309 "/usr/include/features.h" 2 3 4
+# 331 "/usr/include/features.h" 3 4
+# 1 "/usr/include/gnu/stubs.h" 1 3 4
+# 332 "/usr/include/features.h" 2 3 4
+# 27 "/usr/include/string.h" 2 3 4
+
+
+
+
+
+
+# 1 "/usr/lib/gcc/i486-linux-gnu/4.1.2/include/stddef.h" 1 3 4
+# 214 "/usr/lib/gcc/i486-linux-gnu/4.1.2/include/stddef.h" 3 4
+typedef unsigned int size_t;
+# 34 "/usr/include/string.h" 2 3 4
+
+
+
+
+extern void *memcpy (void *__restrict __dest,
+       __const void *__restrict __src, size_t __n)
+     __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1, 2)));
+
+
+extern void *memmove (void *__dest, __const void *__src, size_t __n)
+     __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1, 2)));
+
+
+
+
+
+
+extern void *memccpy (void *__restrict __dest, __const void *__restrict __src,
+        int __c, size_t __n)
+     __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1, 2)));
+
+
+
+
+
+extern void *memset (void *__s, int __c, size_t __n) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
+
+
+extern int memcmp (__const void *__s1, __const void *__s2, size_t __n)
+     __attribute__ ((__nothrow__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2)));
+
+
+extern void *memchr (__const void *__s, int __c, size_t __n)
+      __attribute__ ((__nothrow__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1)));
+
+# 82 "/usr/include/string.h" 3 4
+
+
+extern char *strcpy (char *__restrict __dest, __const char *__restrict __src)
+     __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1, 2)));
+
+extern char *strncpy (char *__restrict __dest,
+        __const char *__restrict __src, size_t __n)
+     __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1, 2)));
+
+
+extern char *strcat (char *__restrict __dest, __const char *__restrict __src)
+     __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1, 2)));
+
+extern char *strncat (char *__restrict __dest, __const char *__restrict __src,
+        size_t __n) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1, 2)));
+
+
+extern int strcmp (__const char *__s1, __const char *__s2)
+     __attribute__ ((__nothrow__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2)));
+
+extern int strncmp (__const char *__s1, __const char *__s2, size_t __n)
+     __attribute__ ((__nothrow__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2)));
+
+
+extern int strcoll (__const char *__s1, __const char *__s2)
+     __attribute__ ((__nothrow__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2)));
+
+extern size_t strxfrm (char *__restrict __dest,
+         __const char *__restrict __src, size_t __n)
+     __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (2)));
+
+# 130 "/usr/include/string.h" 3 4
+extern char *strdup (__const char *__s)
+     __attribute__ ((__nothrow__)) __attribute__ ((__malloc__)) __attribute__ ((__nonnull__ (1)));
+# 165 "/usr/include/string.h" 3 4
+
+
+extern char *strchr (__const char *__s, int __c)
+     __attribute__ ((__nothrow__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1)));
+
+extern char *strrchr (__const char *__s, int __c)
+     __attribute__ ((__nothrow__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1)));
+
+# 181 "/usr/include/string.h" 3 4
+
+
+
+extern size_t strcspn (__const char *__s, __const char *__reject)
+     __attribute__ ((__nothrow__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2)));
+
+
+extern size_t strspn (__const char *__s, __const char *__accept)
+     __attribute__ ((__nothrow__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2)));
+
+extern char *strpbrk (__const char *__s, __const char *__accept)
+     __attribute__ ((__nothrow__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2)));
+
+extern char *strstr (__const char *__haystack, __const char *__needle)
+     __attribute__ ((__nothrow__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2)));
+
+
+
+extern char *strtok (char *__restrict __s, __const char *__restrict __delim)
+     __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (2)));
+
+
+
+
+extern char *__strtok_r (char *__restrict __s,
+    __const char *__restrict __delim,
+    char **__restrict __save_ptr)
+     __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (2, 3)));
+
+extern char *strtok_r (char *__restrict __s, __const char *__restrict __delim,
+         char **__restrict __save_ptr)
+     __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (2, 3)));
+# 240 "/usr/include/string.h" 3 4
+
+
+extern size_t strlen (__const char *__s)
+     __attribute__ ((__nothrow__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1)));
+
+# 254 "/usr/include/string.h" 3 4
+
+
+extern char *strerror (int __errnum) __attribute__ ((__nothrow__));
+
+# 281 "/usr/include/string.h" 3 4
+extern char *strerror_r (int __errnum, char *__buf, size_t __buflen)
+     __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (2)));
+
+
+
+
+
+extern void __bzero (void *__s, size_t __n) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
+
+
+
+extern void bcopy (__const void *__src, void *__dest, size_t __n)
+     __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1, 2)));
+
+
+extern void bzero (void *__s, size_t __n) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
+
+
+extern int bcmp (__const void *__s1, __const void *__s2, size_t __n)
+     __attribute__ ((__nothrow__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2)));
+
+
+extern char *index (__const char *__s, int __c)
+     __attribute__ ((__nothrow__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1)));
+
+
+extern char *rindex (__const char *__s, int __c)
+     __attribute__ ((__nothrow__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1)));
+
+
+
+extern int ffs (int __i) __attribute__ ((__nothrow__)) __attribute__ ((__const__));
+# 325 "/usr/include/string.h" 3 4
+extern int strcasecmp (__const char *__s1, __const char *__s2)
+     __attribute__ ((__nothrow__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2)));
+
+
+extern int strncasecmp (__const char *__s1, __const char *__s2, size_t __n)
+     __attribute__ ((__nothrow__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2)));
+# 348 "/usr/include/string.h" 3 4
+extern char *strsep (char **__restrict __stringp,
+       __const char *__restrict __delim)
+     __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1, 2)));
+# 426 "/usr/include/string.h" 3 4
+
+# 1806 "/usr/include/apache2/httpd.h" 2
+
+char * ap_strchr(char *s, int c);
+const char * ap_strchr_c(const char *s, int c);
+char * ap_strrchr(char *s, int c);
+const char * ap_strrchr_c(const char *s, int c);
+char * ap_strstr(char *s, const char *c);
+const char * ap_strstr_c(const char *s, const char *c);
+# 30 "/usr/include/apache2/http_protocol.h" 2
+
+
+
+
+# 1 "/usr/include/apache2/util_filter.h" 1
+# 50 "/usr/include/apache2/util_filter.h"
+typedef enum {
+
+    AP_MODE_READBYTES,
+
+
+
+
+    AP_MODE_GETLINE,
+
+    AP_MODE_EATCRLF,
+
+
+    AP_MODE_SPECULATIVE,
+
+
+
+
+    AP_MODE_EXHAUSTIVE,
+
+
+
+    AP_MODE_INIT
+} ap_input_mode_t;
+# 101 "/usr/include/apache2/util_filter.h"
+typedef struct ap_filter_t ap_filter_t;
+# 136 "/usr/include/apache2/util_filter.h"
+typedef apr_status_t (*ap_out_filter_func)(ap_filter_t *f,
+                                           apr_bucket_brigade *b);
+typedef apr_status_t (*ap_in_filter_func)(ap_filter_t *f,
+                                          apr_bucket_brigade *b,
+                                          ap_input_mode_t mode,
+                                          apr_read_type_e block,
+                                          apr_off_t readbytes);
+typedef int (*ap_init_filter_func)(ap_filter_t *f);
+
+typedef union ap_filter_func {
+    ap_out_filter_func out_func;
+    ap_in_filter_func in_func;
+} ap_filter_func;
+# 160 "/usr/include/apache2/util_filter.h"
+typedef enum {
+
+
+    AP_FTYPE_RESOURCE = 10,
+
+
+
+    AP_FTYPE_CONTENT_SET = 20,
+
+
+    AP_FTYPE_PROTOCOL = 30,
+
+    AP_FTYPE_TRANSCODE = 40,
+# 182 "/usr/include/apache2/util_filter.h"
+    AP_FTYPE_CONNECTION = 50,
+
+
+    AP_FTYPE_NETWORK = 60
+} ap_filter_type;
+# 201 "/usr/include/apache2/util_filter.h"
+typedef struct ap_filter_rec_t ap_filter_rec_t;
+typedef struct ap_filter_provider_t ap_filter_provider_t;
+# 217 "/usr/include/apache2/util_filter.h"
+struct ap_filter_rec_t {
+
+    const char *name;
+
+
+    ap_filter_func filter_func;
+
+
+
+
+
+
+    ap_init_filter_func filter_init_func;
+
+
+
+
+
+
+    ap_filter_type ftype;
+
+
+    struct ap_filter_rec_t *next;
+
+
+    ap_filter_provider_t *providers;
+
+
+    int debug;
+
+
+    unsigned int proto_flags;
+};
+# 258 "/usr/include/apache2/util_filter.h"
+struct ap_filter_t {
+
+
+
+    ap_filter_rec_t *frec;
+
+
+    void *ctx;
+
+
+    ap_filter_t *next;
+
+
+
+
+
+    request_rec *r;
+
+
+
+
+    conn_rec *c;
+};
+# 295 "/usr/include/apache2/util_filter.h"
+apr_status_t ap_get_brigade(ap_filter_t *filter,
+                                        apr_bucket_brigade *bucket,
+                                        ap_input_mode_t mode,
+                                        apr_read_type_e block,
+                                        apr_off_t readbytes);
+# 309 "/usr/include/apache2/util_filter.h"
+apr_status_t ap_pass_brigade(ap_filter_t *filter,
+                                         apr_bucket_brigade *bucket);
+# 326 "/usr/include/apache2/util_filter.h"
+ap_filter_rec_t * ap_register_input_filter(const char *name,
+                                          ap_in_filter_func filter_func,
+                                          ap_init_filter_func filter_init,
+                                          ap_filter_type ftype);
+# 347 "/usr/include/apache2/util_filter.h"
+ap_filter_rec_t * ap_register_output_filter(const char *name,
+                                            ap_out_filter_func filter_func,
+                                            ap_init_filter_func filter_init,
+                                            ap_filter_type ftype);
+# 372 "/usr/include/apache2/util_filter.h"
+ap_filter_rec_t * ap_register_output_filter_protocol(
+                                            const char *name,
+                                            ap_out_filter_func filter_func,
+                                            ap_init_filter_func filter_init,
+                                            ap_filter_type ftype,
+                                            unsigned int proto_flags);
+# 397 "/usr/include/apache2/util_filter.h"
+ap_filter_t * ap_add_input_filter(const char *name, void *ctx,
+                                              request_rec *r, conn_rec *c);
+# 409 "/usr/include/apache2/util_filter.h"
+ap_filter_t * ap_add_input_filter_handle(ap_filter_rec_t *f,
+                                                     void *ctx,
+                                                     request_rec *r,
+                                                     conn_rec *c);
+
+
+
+
+
+
+ap_filter_rec_t * ap_get_input_filter_handle(const char *name);
+# 429 "/usr/include/apache2/util_filter.h"
+ap_filter_t * ap_add_output_filter(const char *name, void *ctx,
+                                               request_rec *r, conn_rec *c);
+# 440 "/usr/include/apache2/util_filter.h"
+ap_filter_t * ap_add_output_filter_handle(ap_filter_rec_t *f,
+                                                      void *ctx,
+                                                      request_rec *r,
+                                                      conn_rec *c);
+
+
+
+
+
+
+ap_filter_rec_t * ap_get_output_filter_handle(const char *name);
+
+
+
+
+
+
+
+void ap_remove_input_filter(ap_filter_t *f);
+
+
+
+
+
+
+
+void ap_remove_output_filter(ap_filter_t *f);
+# 491 "/usr/include/apache2/util_filter.h"
+apr_status_t ap_save_brigade(ap_filter_t *f,
+                                         apr_bucket_brigade **save_to,
+                                         apr_bucket_brigade **b, apr_pool_t *p);
+# 503 "/usr/include/apache2/util_filter.h"
+apr_status_t ap_filter_flush(apr_bucket_brigade *bb,
+                                                void *ctx);
+
+
+
+
+
+
+apr_status_t ap_fflush(ap_filter_t *f, apr_bucket_brigade *bb);
+# 547 "/usr/include/apache2/util_filter.h"
+apr_status_t ap_fputstrs(ap_filter_t *f,
+                                            apr_bucket_brigade *bb,
+                                            ...);
+# 558 "/usr/include/apache2/util_filter.h"
+apr_status_t ap_fprintf(ap_filter_t *f,
+                                           apr_bucket_brigade *bb,
+                                           const char *fmt,
+                                           ...)
+        __attribute__((format(printf,3,4)));
+
+
+
+
+
+
+
+void ap_filter_protocol(ap_filter_t* f, unsigned int proto_flags);
+# 35 "/usr/include/apache2/http_protocol.h" 2
+# 45 "/usr/include/apache2/http_protocol.h"
+APR_DECLARE_EXTERNAL_HOOK(ap,AP,void,insert_error_filter,(request_rec *r))
+
+
+
+
+ extern ap_filter_rec_t *ap_old_write_func;
+# 62 "/usr/include/apache2/http_protocol.h"
+request_rec *ap_read_request(conn_rec *c);
+
+
+
+
+
+void ap_get_mime_headers(request_rec *r);
+
+
+
+
+
+
+
+void ap_get_mime_headers_core(request_rec *r,
+                                          apr_bucket_brigade *bb);
+# 86 "/usr/include/apache2/http_protocol.h"
+void ap_finalize_request_protocol(request_rec *r);
+# 97 "/usr/include/apache2/http_protocol.h"
+void ap_send_error_response(request_rec *r, int recursive_error);
+# 111 "/usr/include/apache2/http_protocol.h"
+void ap_set_content_length(request_rec *r, apr_off_t length);
+
+
+
+
+
+
+int ap_set_keepalive(request_rec *r);
+# 127 "/usr/include/apache2/http_protocol.h"
+apr_time_t ap_rationalize_mtime(request_rec *r, apr_time_t mtime);
+# 140 "/usr/include/apache2/http_protocol.h"
+const char * ap_make_content_type(request_rec *r,
+                                              const char *type);
+# 159 "/usr/include/apache2/http_protocol.h"
+char * ap_make_etag(request_rec *r, int force_weak);
+
+
+
+
+
+void ap_set_etag(request_rec *r);
+
+
+
+
+
+void ap_set_last_modified(request_rec *r);
+# 181 "/usr/include/apache2/http_protocol.h"
+int ap_meets_conditions(request_rec *r);
+# 203 "/usr/include/apache2/http_protocol.h"
+apr_status_t ap_send_fd(apr_file_t *fd, request_rec *r, apr_off_t offset,
+                                   apr_size_t length, apr_size_t *nbytes);
+# 228 "/usr/include/apache2/http_protocol.h"
+int ap_method_register(apr_pool_t *p, const char *methname);
+
+
+
+
+
+
+void ap_method_registry_init(apr_pool_t *p);
+# 253 "/usr/include/apache2/http_protocol.h"
+ap_method_list_t * ap_make_method_list(apr_pool_t *p, int nelts);
+# 262 "/usr/include/apache2/http_protocol.h"
+void ap_copy_method_list(ap_method_list_t *dest,
+         ap_method_list_t *src);
+# 273 "/usr/include/apache2/http_protocol.h"
+int ap_method_in_list(ap_method_list_t *l, const char *method);
+# 283 "/usr/include/apache2/http_protocol.h"
+void ap_method_list_add(ap_method_list_t *l, const char *method);
+# 292 "/usr/include/apache2/http_protocol.h"
+void ap_method_list_remove(ap_method_list_t *l,
+           const char *method);
+
+
+
+
+
+
+
+void ap_clear_method_list(ap_method_list_t *l);
+# 310 "/usr/include/apache2/http_protocol.h"
+void ap_set_content_type(request_rec *r, const char *ct);
+# 322 "/usr/include/apache2/http_protocol.h"
+int ap_rputc(int c, request_rec *r);
+
+
+
+
+
+
+
+int ap_rputs(const char *str, request_rec *r);
+# 339 "/usr/include/apache2/http_protocol.h"
+int ap_rwrite(const void *buf, int nbyte, request_rec *r);
+
+
+
+
+
+
+
+int ap_rvputs(request_rec *r,...);
+# 356 "/usr/include/apache2/http_protocol.h"
+int ap_vrprintf(request_rec *r, const char *fmt, va_list vlist);
+# 365 "/usr/include/apache2/http_protocol.h"
+int ap_rprintf(request_rec *r, const char *fmt,...)
+    __attribute__((format(printf,2,3)));
+
+
+
+
+
+
+int ap_rflush(request_rec *r);
+
+
+
+
+
+
+
+int ap_index_of_response(int status);
+# 390 "/usr/include/apache2/http_protocol.h"
+const char * ap_get_status_line(int status);
+# 405 "/usr/include/apache2/http_protocol.h"
+int ap_setup_client_block(request_rec *r, int read_policy);
+# 415 "/usr/include/apache2/http_protocol.h"
+int ap_should_client_block(request_rec *r);
+# 426 "/usr/include/apache2/http_protocol.h"
+long ap_get_client_block(request_rec *r, char *buffer, apr_size_t bufsiz);
+# 438 "/usr/include/apache2/http_protocol.h"
+int ap_discard_request_body(request_rec *r);
+
+
+
+
+
+
+
+void ap_note_auth_failure(request_rec *r);
+
+
+
+
+
+
+
+void ap_note_basic_auth_failure(request_rec *r);
+
+
+
+
+
+
+
+void ap_note_digest_auth_failure(request_rec *r);
+# 476 "/usr/include/apache2/http_protocol.h"
+int ap_get_basic_auth_pw(request_rec *r, const char **pw);
+# 487 "/usr/include/apache2/http_protocol.h"
+void ap_parse_uri(request_rec *r, const char *uri);
+# 499 "/usr/include/apache2/http_protocol.h"
+int ap_getline(char *s, int n, request_rec *r, int fold);
+# 534 "/usr/include/apache2/http_protocol.h"
+apr_status_t ap_rgetline_core(char **s, apr_size_t n,
+                                          apr_size_t *read,
+                                          request_rec *r, int fold,
+                                          apr_bucket_brigade *bb);
+
+
+
+
+
+
+
+int ap_method_number_of(const char *method);
+# 554 "/usr/include/apache2/http_protocol.h"
+const char * ap_method_name_of(apr_pool_t *p, int methnum);
+# 569 "/usr/include/apache2/http_protocol.h"
+APR_DECLARE_EXTERNAL_HOOK(ap,AP,int,post_read_request,(request_rec *r))
+
+
+
+
+
+
+
+APR_DECLARE_EXTERNAL_HOOK(ap,AP,int,log_transaction,(request_rec *r))
+
+
+
+
+
+
+
+APR_DECLARE_EXTERNAL_HOOK(ap,AP,const char *,http_scheme,(const request_rec *r))
+
+
+
+
+
+
+APR_DECLARE_EXTERNAL_HOOK(ap,AP,apr_port_t,default_port,(const request_rec *r))
+
+
+typedef struct ap_bucket_error ap_bucket_error;
+# 606 "/usr/include/apache2/http_protocol.h"
+struct ap_bucket_error {
+
+    apr_bucket_refcount refcount;
+
+    int status;
+
+    const char *data;
+};
+
+
+ extern const apr_bucket_type_t ap_bucket_type_error;
+# 633 "/usr/include/apache2/http_protocol.h"
+apr_bucket * ap_bucket_error_make(apr_bucket *b, int error,
+                const char *buf, apr_pool_t *p);
+# 644 "/usr/include/apache2/http_protocol.h"
+apr_bucket * ap_bucket_error_create(int error, const char *buf,
+                                                apr_pool_t *p,
+                                                apr_bucket_alloc_t *list);
+
+apr_status_t ap_byterange_filter(ap_filter_t *f, apr_bucket_brigade *b);
+apr_status_t ap_http_header_filter(ap_filter_t *f, apr_bucket_brigade *b);
+apr_status_t ap_content_length_filter(ap_filter_t *,
+                                                              apr_bucket_brigade *);
+apr_status_t ap_old_write_filter(ap_filter_t *f, apr_bucket_brigade *b);
+
+
+
+
+
+
+void ap_set_sub_req_protocol(request_rec *rnew, const request_rec *r);
+
+
+
+
+
+
+void ap_finalize_sub_req_protocol(request_rec *sub_r);
diff --git a/test/chxj_chtml10/test_chxj_chtml10 b/test/chxj_chtml10/test_chxj_chtml10
new file mode 100755 (executable)
index 0000000..4610eb8
Binary files /dev/null and b/test/chxj_chtml10/test_chxj_chtml10 differ
diff --git a/test/chxj_chtml10/test_chxj_chtml10.c b/test/chxj_chtml10/test_chxj_chtml10.c
new file mode 100644 (file)
index 0000000..c0cd649
--- /dev/null
@@ -0,0 +1,175 @@
+#include <CUnit/CUnit.h>
+#include <CUnit/Console.h>
+#include <CUnit/Basic.h>
+#include <stdio.h>
+#define CHXJ_TEST
+
+#include "chxj_apache.h"
+#include "apr.h"
+#include "qs_malloc.c"
+#include "qs_log.c"
+#include "qs_parse_tag.c"
+#include "qs_parse_string.c"
+#include "qs_parse_attr.c"
+#include "qs_ignore_sp.c"
+#include "qs_parse_file.c"
+#include "chxj_buffered_write.c"
+#include "chxj_chtml10.c"
+#include "chxj_chtml20.c"
+#include "chxj_chtml30.c"
+#include "chxj_jhtml.c"
+#include "chxj_hdml.c"
+#include "chxj_xhtml_mobile_1_0.c"
+#include "chxj_node_exchange.c"
+#include "chxj_tag_util.c"
+#include "chxj_encoding.c"
+#include "chxj_cookie.c"
+#include "chxj_img_conv.c"
+#include "chxj_url_encode.c"
+#include "chxj_apache.c"
+#include "chxj_dbm.c"
+#include "chxj_str_util.c"
+#include <iconv.h>
+
+
+
+void test_chtml10_001();
+void test_chtml10_002();
+
+void test_log_rerror(const char *file, int line, int level, apr_status_t status, const request_rec *r, const char *fmt, ...)
+{
+  va_list ap;
+  fprintf(stderr, "ERROR LOG %s:%d ", file,line);
+  va_start(ap, fmt);
+  vfprintf(stderr, fmt,ap);
+  va_end(ap);
+  fprintf(stderr, "\n");
+}
+void test_log_error(const char *file, int line, int level, apr_status_t status, const request_rec *r, const char *fmt, ...)
+{
+  va_list ap;
+  fprintf(stderr, "ERROR LOG %s:%d ", file,line);
+  va_start(ap, fmt);
+  vfprintf(stderr, fmt,ap);
+  va_end(ap);
+  fprintf(stderr, "\n");
+}
+
+char *chxj_qr_code_blob_handler(request_rec* r, const char* indata, size_t* len)
+{
+  return NULL;
+}
+
+char *test_os_escape_path(apr_pool_t *p, const char *path, int partial)
+{
+  return (char *)path;
+}
+
+void test_set_content_type(request_rec *r, const char *ct)
+{
+  fprintf(stderr, "%s:%d set_content_type(%s)\n", __FILE__,__LINE__,ct);
+}
+
+const char *test_run_http_scheme(request_rec *r)
+{
+  static char *s = "http";
+  return s;
+}
+
+void * test_get_module_config(const ap_conf_vector_t *cv, const module *m)
+{
+  return NULL;
+}
+
+chxjconvrule_entry *
+chxj_apply_convrule(request_rec* r, apr_array_header_t* convrules)
+{
+  chxjconvrule_entry entries;
+  return NULL;
+}
+
+#define APR_INIT \
+  request_rec r; \
+  apr_pool_t *p; \
+  do { \
+    apr_initialize(); \
+    apr_pool_create(&p, NULL); \
+    r.pool = p; \
+  } \
+  while (0)
+
+#define APR_TERM \
+  do { \
+    apr_terminate(); \
+  } while (0)
+
+#define COOKIE_INIT(X) \
+  do { \
+    X.cookie_id = "test_cookie_id"; \
+  } while (0) \
+
+#define SPEC_INIT(X) \
+  do { \
+    X.html_spec_type = CHXJ_SPEC_Chtml_1_0; \
+  } while (0)
+
+int
+main()
+{
+  CU_pSuite chtml10_suite;
+  CU_initialize_registry();
+  chtml10_suite = CU_add_suite("test chxj_exchange_chtml10()", NULL, NULL);
+  CU_add_test(chtml10_suite, "test void src1",             test_chtml10_001);
+  CU_add_test(chtml10_suite, "test void src2",             test_chtml10_002);
+  CU_basic_run_tests();
+  CU_cleanup_registry();
+
+  return(0);
+}
+
+
+void test_chtml10_001() 
+{
+#define  TEST_STRING "<!-- comment -->"
+  char  *ret;
+  device_table spec;
+  chxjconvrule_entry entry;
+  cookie_t cookie;
+  apr_size_t destlen;
+  APR_INIT;
+
+  COOKIE_INIT(cookie);
+
+  SPEC_INIT(spec);
+
+  ret = chxj_exchange_chtml10(&r, &spec, TEST_STRING, sizeof(TEST_STRING)-1, &destlen, &entry, &cookie);
+  CU_ASSERT(ret != NULL);
+  CU_ASSERT(strcmp("\n", ret) == 0);
+  CU_ASSERT(destlen == 1);
+
+  APR_TERM;
+#undef TEST_STRING
+}
+void test_chtml10_002() 
+{
+#define  TEST_STRING ""
+  char  *ret;
+  device_table spec;
+  chxjconvrule_entry entry;
+  cookie_t cookie;
+  apr_size_t destlen;
+  APR_INIT;
+
+  COOKIE_INIT(cookie);
+
+  SPEC_INIT(spec);
+
+  ret = chxj_exchange_chtml10(&r, &spec, TEST_STRING, sizeof(TEST_STRING)-1, &destlen, &entry, &cookie);
+  CU_ASSERT(ret != NULL);
+  CU_ASSERT(strcmp("\n", ret) == 0);
+  CU_ASSERT(destlen == 1);
+
+  APR_TERM;
+#undef TEST_STRING
+}
+
diff --git a/test/qs_parse_string/Makefile b/test/qs_parse_string/Makefile
new file mode 100644 (file)
index 0000000..79a4a7f
--- /dev/null
@@ -0,0 +1,25 @@
+.SUFFIXES:
+.SUFFIXES: .c.o
+
+TARGET= test_parse_comment_tag \
+
+TOP_DIR=../..
+
+INC_DIR=-I$(TOP_DIR)/include \
+  -I/usr/include/apache2 \
+  -I/usr/include/apr-1.0 \
+  -I$(TOP_DIR)/src
+
+all:test
+
+
+
+test: $(TARGET)
+       ./test_parse_comment_tag        
+
+test_parse_comment_tag: test_parse_comment_tag.c
+       gcc -g -o $@ -Wall -lcunit $< $(INC_DIR) -DLINUX=2 -D_REENTRANT -D_GNU_SOURCE -D_LARGEFILE64_SOURCE  -lapr-1
+
+
+clean:
+       rm -f ./test_parse_comment_tag
diff --git a/test/qs_parse_string/test_parse_comment_tag.c b/test/qs_parse_string/test_parse_comment_tag.c
new file mode 100644 (file)
index 0000000..8c261ff
--- /dev/null
@@ -0,0 +1,289 @@
+#include <CUnit/CUnit.h>
+#include <CUnit/Console.h>
+#include <CUnit/Basic.h>
+#include <stdio.h>
+
+#include "httpd.h"
+#include "qs_malloc.c"
+#include "qs_log.c"
+#include "qs_parse_tag.c"
+#include "qs_parse_string.c"
+#include "qs_parse_attr.c"
+#include "qs_ignore_sp.c"
+#include <iconv.h>
+
+
+void test_parse_comment_tag_001();
+void test_parse_comment_tag_002();
+void test_parse_comment_tag_003();
+void test_parse_comment_tag_004();
+void test_parse_comment_tag_005();
+void test_parse_comment_tag_006();
+void test_parse_comment_tag_007();
+void test_parse_comment_tag_008();
+void test_parse_comment_tag_009();
+void test_parse_comment_tag_010();
+
+
+void ap_log_rerror(const char *file, int line, int level, apr_status_t status, const request_rec *r, const char *fmt, ...)
+{
+  va_list ap;
+  fprintf(stderr, "ERROR LOG %s:%d ", file,line);
+  va_start(ap, fmt);
+  vfprintf(stderr, fmt,ap);
+  va_end(ap);
+  fprintf(stderr, "\n");
+}
+
+#define APR_INIT \
+  request_rec r; \
+  apr_pool_t *p; \
+  do { \
+    apr_initialize(); \
+    apr_pool_create(&p, NULL); \
+    r.pool = p; \
+    doc.r = &r; \
+  } \
+  while (0)
+
+#define APR_TERM \
+  do { \
+    apr_terminate(); \
+  } while (0)
+
+
+int
+main()
+{
+  CU_pSuite comment_tag_suite;
+  CU_initialize_registry();
+  comment_tag_suite = CU_add_suite("test qs_parse_string()", NULL, NULL);
+  CU_add_test(comment_tag_suite, "test normal pattern",             test_parse_comment_tag_001);
+  CU_add_test(comment_tag_suite, "test inner tag1",                 test_parse_comment_tag_002);
+  CU_add_test(comment_tag_suite, "test inner tag2",                 test_parse_comment_tag_003);
+  CU_add_test(comment_tag_suite, "test short tag",                  test_parse_comment_tag_004);
+  CU_add_test(comment_tag_suite, "test not close comment tag",      test_parse_comment_tag_005);
+  CU_add_test(comment_tag_suite, "test close only comment tag",     test_parse_comment_tag_006);
+  CU_add_test(comment_tag_suite, "test null string",                test_parse_comment_tag_007);
+  CU_add_test(comment_tag_suite, "test null",                       test_parse_comment_tag_008);
+  CU_add_test(comment_tag_suite, "test minus len",                  test_parse_comment_tag_009);
+  CU_add_test(comment_tag_suite, "test ambiguos close tag",         test_parse_comment_tag_010);
+#if 0
+  CU_console_run_tests();
+  CU_automated_run_tests();
+  CU_ErrorCode CU_basic_run_tests();
+#else
+  CU_basic_run_tests();
+#endif
+  CU_cleanup_registry();
+
+  return(0);
+}
+
+
+void test_parse_comment_tag_001() 
+{
+#define  TEST_STRING "<!-- comment -->"
+  Doc doc;
+  Node *node;
+  APR_INIT;
+
+  qs_init_malloc(&doc);
+  qs_init_root_node(&doc);
+  node = qs_parse_string(&doc, TEST_STRING, sizeof(TEST_STRING)-1);
+
+  CU_ASSERT(node != NULL);
+  CU_ASSERT(node->name != NULL);
+  CU_ASSERT(strcasecmp("ROOT",node->name) == 0);
+  CU_ASSERT(node->child == NULL);
+
+  APR_TERM;
+#undef TEST_STRING
+}
+
+void test_parse_comment_tag_002() 
+{
+#define  TEST_STRING "<!-- <html><head></head><body></body></html> -->"
+  Doc doc;
+  Node *node;
+  APR_INIT;
+
+  qs_init_malloc(&doc);
+  qs_init_root_node(&doc);
+  node = qs_parse_string(&doc, TEST_STRING, sizeof(TEST_STRING)-1);
+
+  CU_ASSERT(node != NULL);
+  CU_ASSERT(node->name != NULL);
+  CU_ASSERT(strcasecmp("ROOT",node->name) == 0);
+  CU_ASSERT(node->child == NULL);
+
+  APR_TERM;
+#undef TEST_STRING
+}
+
+void test_parse_comment_tag_003() 
+{
+#define  TEST_STRING "<html><!-- <html><head></head><body></body></html> --><body>"
+  Doc doc;
+  Node *node;
+  Node *nn;
+  APR_INIT;
+
+  qs_init_malloc(&doc);
+  qs_init_root_node(&doc);
+  node = qs_parse_string(&doc, TEST_STRING, sizeof(TEST_STRING)-1);
+
+  CU_ASSERT(node != NULL);
+  CU_ASSERT(node->name != NULL);
+  CU_ASSERT(strcasecmp("ROOT",node->name) == 0);
+  CU_ASSERT(node->child != NULL);
+  for (nn = qs_get_child_node(&doc,node);
+       nn;
+       nn = qs_get_next_node(&doc,nn)) {
+    CU_ASSERT(STRCASEEQ('h','H',"html",nn->name) || STRCASEEQ('b','B',"body",nn->name));
+  }
+
+  APR_TERM;
+#undef TEST_STRING
+}
+void test_parse_comment_tag_004() 
+{
+#define  TEST_STRING "<!---->"
+  Doc doc;
+  Node *node;
+  APR_INIT;
+
+  qs_init_malloc(&doc);
+  qs_init_root_node(&doc);
+  node = qs_parse_string(&doc, TEST_STRING, sizeof(TEST_STRING)-1);
+
+  CU_ASSERT(node != NULL);
+  CU_ASSERT(node->name != NULL);
+  CU_ASSERT(strcasecmp("ROOT",node->name) == 0);
+  CU_ASSERT(node->child == NULL);
+  APR_TERM;
+#undef TEST_STRING
+}
+void test_parse_comment_tag_005() 
+{
+#define  TEST_STRING "<!--"
+  Doc doc;
+  Node *node;
+  APR_INIT;
+
+  qs_init_malloc(&doc);
+  qs_init_root_node(&doc);
+  node = qs_parse_string(&doc, TEST_STRING, sizeof(TEST_STRING)-1);
+
+  CU_ASSERT(node != NULL);
+  CU_ASSERT(node->name != NULL);
+  CU_ASSERT(strcasecmp("ROOT",node->name) == 0);
+  CU_ASSERT(node->child == NULL);
+  APR_TERM;
+#undef TEST_STRING
+}
+void test_parse_comment_tag_006() 
+{
+#define  TEST_STRING "-->"
+  Doc doc;
+  Node *node;
+  Node *nn;
+  APR_INIT;
+
+  qs_init_malloc(&doc);
+  qs_init_root_node(&doc);
+  node = qs_parse_string(&doc, TEST_STRING, sizeof(TEST_STRING)-1);
+
+  CU_ASSERT(node != NULL);
+  CU_ASSERT(node->name != NULL);
+  CU_ASSERT(strcasecmp("ROOT",node->name) == 0);
+  CU_ASSERT(node->child != NULL);
+  for (nn = qs_get_child_node(&doc,node);
+       nn;
+       nn = qs_get_next_node(&doc,nn)) {
+    CU_ASSERT(STRCASEEQ('t','T',"text",nn->name));
+  }
+  
+  APR_TERM;
+#undef TEST_STRING
+}
+void test_parse_comment_tag_007() 
+{
+#define  TEST_STRING ""
+  Doc doc;
+  Node *node;
+  APR_INIT;
+
+  qs_init_malloc(&doc);
+  qs_init_root_node(&doc);
+  node = qs_parse_string(&doc, TEST_STRING, sizeof(TEST_STRING)-1);
+
+  CU_ASSERT(node != NULL);
+  CU_ASSERT(node->name != NULL);
+  CU_ASSERT(strcasecmp("ROOT",node->name) == 0);
+  CU_ASSERT(node->child == NULL);
+  APR_TERM;
+#undef TEST_STRING
+}
+void test_parse_comment_tag_008() 
+{
+#define  TEST_STRING NULL
+  Doc doc;
+  Node *node;
+  APR_INIT;
+
+  qs_init_malloc(&doc);
+  qs_init_root_node(&doc);
+  node = qs_parse_string(&doc, TEST_STRING, sizeof(TEST_STRING)-1);
+
+  CU_ASSERT(node != NULL);
+  CU_ASSERT(node->name != NULL);
+  CU_ASSERT(strcasecmp("ROOT",node->name) == 0);
+  CU_ASSERT(node->child == NULL);
+  APR_TERM;
+#undef TEST_STRING
+}
+void test_parse_comment_tag_009() 
+{
+#define  TEST_STRING ""
+  Doc doc;
+  Node *node;
+  APR_INIT;
+
+  qs_init_malloc(&doc);
+  qs_init_root_node(&doc);
+  node = qs_parse_string(&doc, TEST_STRING, -1);
+
+  CU_ASSERT(node != NULL);
+  CU_ASSERT(node->name != NULL);
+  CU_ASSERT(strcasecmp("ROOT",node->name) == 0);
+  CU_ASSERT(node->child == NULL);
+  APR_TERM;
+#undef TEST_STRING
+}
+
+void test_parse_comment_tag_010() 
+{
+#define  TEST_STRING "<!--'//-->'"
+  Doc doc;
+  Node *node;
+  Node *nn;
+  APR_INIT;
+
+  qs_init_malloc(&doc);
+  qs_init_root_node(&doc);
+  node = qs_parse_string(&doc, TEST_STRING,sizeof(TEST_STRING)-1);
+
+  CU_ASSERT(node != NULL);
+  CU_ASSERT(node->name != NULL);
+  CU_ASSERT(strcasecmp("ROOT",node->name) == 0);
+  CU_ASSERT(node->child != NULL);
+  for (nn = qs_get_child_node(&doc,node);
+       nn;
+       nn = qs_get_next_node(&doc,nn)) {
+    CU_ASSERT(STRCASEEQ('t','T',"text",nn->name));
+    CU_ASSERT(strcmp(nn->otext, "'") == 0);
+  }
+  APR_TERM;
+#undef TEST_STRING
+}