OSDN Git Service

* Changed specification for encoding.
authorkonn <konn@1a406e8e-add9-4483-a2c8-d8cac5b7c224>
Thu, 20 Nov 2008 01:07:59 +0000 (01:07 +0000)
committerkonn <konn@1a406e8e-add9-4483-a2c8-d8cac5b7c224>
Thu, 20 Nov 2008 01:07:59 +0000 (01:07 +0000)
    - It replaces with '?' for the illegal character code and the processing
      continuation is done.

git-svn-id: svn+ssh://svn.sourceforge.jp/svnroot/modchxj/mod_chxj/branches/RELEASE_0_12_0@4491 1a406e8e-add9-4483-a2c8-d8cac5b7c224

configure
include/chxj_apache.h
include/chxj_encoding.h
include/config.h
src/chxj_encoding.c

index 2d841e3..805b277 100755 (executable)
--- a/configure
+++ b/configure
@@ -2,6 +2,8 @@
 # Guess values for system-dependent variables and create Makefiles.
 # Generated by GNU Autoconf 2.61 for mod_chxj 0.12.18.
 #
+# Report bugs to <konn@users.sourceforge.jp>.
+#
 # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
 # 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
 # This configure script is free software; the Free Software Foundation
@@ -728,7 +730,7 @@ PACKAGE_NAME='mod_chxj'
 PACKAGE_TARNAME='mod_chxj'
 PACKAGE_VERSION='0.12.18'
 PACKAGE_STRING='mod_chxj 0.12.18'
-PACKAGE_BUGREPORT=''
+PACKAGE_BUGREPORT='konn@users.sourceforge.jp'
 
 ac_unique_file="src/mod_chxj.c"
 # Factoring default headers for most tests.
@@ -1532,6 +1534,7 @@ Some influential environment variables:
 Use these variables to override the choices made by `configure' or to help
 it to find libraries and programs with nonstandard names/locations.
 
+Report bugs to <konn@users.sourceforge.jp>.
 _ACEOF
 ac_status=$?
 fi
@@ -4459,7 +4462,7 @@ ia64-*-hpux*)
   ;;
 *-*-irix6*)
   # Find out which ABI we are using.
-  echo '#line 4462 "configure"' > conftest.$ac_ext
+  echo '#line 4465 "configure"' > conftest.$ac_ext
   if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
@@ -5228,7 +5231,12 @@ echo "$as_me: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\
 echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
     { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
 echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
-
+    ( cat <<\_ASBOX
+## ---------------------------------------- ##
+## Report this to konn@users.sourceforge.jp ##
+## ---------------------------------------- ##
+_ASBOX
+     ) | sed "s/^/$as_me: WARNING:     /" >&2
     ;;
 esac
 { echo "$as_me:$LINENO: checking for $ac_header" >&5
@@ -7185,11 +7193,11 @@ else
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:7188: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:7196: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>conftest.err)
    ac_status=$?
    cat conftest.err >&5
-   echo "$as_me:7192: \$? = $ac_status" >&5
+   echo "$as_me:7200: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s "$ac_outfile"; then
      # The compiler can only warn and ignore the option if not recognized
      # So say no if there are warnings other than the usual output.
@@ -7453,11 +7461,11 @@ else
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:7456: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:7464: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>conftest.err)
    ac_status=$?
    cat conftest.err >&5
-   echo "$as_me:7460: \$? = $ac_status" >&5
+   echo "$as_me:7468: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s "$ac_outfile"; then
      # The compiler can only warn and ignore the option if not recognized
      # So say no if there are warnings other than the usual output.
@@ -7557,11 +7565,11 @@ else
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:7560: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:7568: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>out/conftest.err)
    ac_status=$?
    cat out/conftest.err >&5
-   echo "$as_me:7564: \$? = $ac_status" >&5
+   echo "$as_me:7572: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s out/conftest2.$ac_objext
    then
      # The compiler can only warn and ignore the option if not recognized
@@ -9854,7 +9862,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<EOF
-#line 9857 "configure"
+#line 9865 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -9954,7 +9962,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<EOF
-#line 9957 "configure"
+#line 9965 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -12290,11 +12298,11 @@ else
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:12293: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:12301: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>conftest.err)
    ac_status=$?
    cat conftest.err >&5
-   echo "$as_me:12297: \$? = $ac_status" >&5
+   echo "$as_me:12305: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s "$ac_outfile"; then
      # The compiler can only warn and ignore the option if not recognized
      # So say no if there are warnings other than the usual output.
@@ -12394,11 +12402,11 @@ else
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:12397: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:12405: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>out/conftest.err)
    ac_status=$?
    cat out/conftest.err >&5
-   echo "$as_me:12401: \$? = $ac_status" >&5
+   echo "$as_me:12409: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s out/conftest2.$ac_objext
    then
      # The compiler can only warn and ignore the option if not recognized
@@ -13955,11 +13963,11 @@ else
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:13958: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:13966: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>conftest.err)
    ac_status=$?
    cat conftest.err >&5
-   echo "$as_me:13962: \$? = $ac_status" >&5
+   echo "$as_me:13970: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s "$ac_outfile"; then
      # The compiler can only warn and ignore the option if not recognized
      # So say no if there are warnings other than the usual output.
@@ -14059,11 +14067,11 @@ else
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:14062: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:14070: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>out/conftest.err)
    ac_status=$?
    cat out/conftest.err >&5
-   echo "$as_me:14066: \$? = $ac_status" >&5
+   echo "$as_me:14074: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s out/conftest2.$ac_objext
    then
      # The compiler can only warn and ignore the option if not recognized
@@ -16246,11 +16254,11 @@ else
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:16249: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:16257: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>conftest.err)
    ac_status=$?
    cat conftest.err >&5
-   echo "$as_me:16253: \$? = $ac_status" >&5
+   echo "$as_me:16261: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s "$ac_outfile"; then
      # The compiler can only warn and ignore the option if not recognized
      # So say no if there are warnings other than the usual output.
@@ -16514,11 +16522,11 @@ else
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:16517: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:16525: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>conftest.err)
    ac_status=$?
    cat conftest.err >&5
-   echo "$as_me:16521: \$? = $ac_status" >&5
+   echo "$as_me:16529: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s "$ac_outfile"; then
      # The compiler can only warn and ignore the option if not recognized
      # So say no if there are warnings other than the usual output.
@@ -16618,11 +16626,11 @@ else
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:16621: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:16629: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>out/conftest.err)
    ac_status=$?
    cat out/conftest.err >&5
-   echo "$as_me:16625: \$? = $ac_status" >&5
+   echo "$as_me:16633: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s out/conftest2.$ac_objext
    then
      # The compiler can only warn and ignore the option if not recognized
@@ -20261,7 +20269,12 @@ echo "$as_me: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\
 echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
     { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
 echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
-
+    ( cat <<\_ASBOX
+## ---------------------------------------- ##
+## Report this to konn@users.sourceforge.jp ##
+## ---------------------------------------- ##
+_ASBOX
+     ) | sed "s/^/$as_me: WARNING:     /" >&2
     ;;
 esac
 { echo "$as_me:$LINENO: checking for $ac_header" >&5
@@ -20403,7 +20416,12 @@ echo "$as_me: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\
 echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
     { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
 echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
-
+    ( cat <<\_ASBOX
+## ---------------------------------------- ##
+## Report this to konn@users.sourceforge.jp ##
+## ---------------------------------------- ##
+_ASBOX
+     ) | sed "s/^/$as_me: WARNING:     /" >&2
     ;;
 esac
 { echo "$as_me:$LINENO: checking for $ac_header" >&5
@@ -20543,7 +20561,12 @@ echo "$as_me: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\
 echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
     { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
 echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
-
+    ( cat <<\_ASBOX
+## ---------------------------------------- ##
+## Report this to konn@users.sourceforge.jp ##
+## ---------------------------------------- ##
+_ASBOX
+     ) | sed "s/^/$as_me: WARNING:     /" >&2
     ;;
 esac
 { echo "$as_me:$LINENO: checking for $ac_header" >&5
@@ -20683,7 +20706,12 @@ echo "$as_me: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\
 echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
     { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
 echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
-
+    ( cat <<\_ASBOX
+## ---------------------------------------- ##
+## Report this to konn@users.sourceforge.jp ##
+## ---------------------------------------- ##
+_ASBOX
+     ) | sed "s/^/$as_me: WARNING:     /" >&2
     ;;
 esac
 { echo "$as_me:$LINENO: checking for $ac_header" >&5
@@ -20833,7 +20861,12 @@ echo "$as_me: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\
 echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
     { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
 echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
-
+    ( cat <<\_ASBOX
+## ---------------------------------------- ##
+## Report this to konn@users.sourceforge.jp ##
+## ---------------------------------------- ##
+_ASBOX
+     ) | sed "s/^/$as_me: WARNING:     /" >&2
     ;;
 esac
 { echo "$as_me:$LINENO: checking for $ac_header" >&5
@@ -21192,7 +21225,12 @@ echo "$as_me: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\
 echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
     { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
 echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
-
+    ( cat <<\_ASBOX
+## ---------------------------------------- ##
+## Report this to konn@users.sourceforge.jp ##
+## ---------------------------------------- ##
+_ASBOX
+     ) | sed "s/^/$as_me: WARNING:     /" >&2
     ;;
 esac
 { echo "$as_me:$LINENO: checking for $ac_header" >&5
index 7b3a685..ce59c53 100644 (file)
@@ -99,6 +99,7 @@ extern char *test_ap_escape_html(apr_pool_t *p, const char *s);
 #    undef PACKAGE_STRING
 #    undef PACKAGE_TARNAME
 #    undef PACKAGE_VERSION
+#    undef PACKAGE_BUGREPORT
 #    include "config.h"
 #  endif
 #  define chxj_log_rerror ap_log_rerror
index 29ecf83..1574640 100644 (file)
@@ -38,5 +38,14 @@ extern char* chxj_encoding_parameter(
   request_rec*       r, 
   const char*        value);
 
+extern void
+chxj_convert_illegal_charactor_sequence(
+  request_rec         *r,
+  chxjconvrule_entry  *entryp,
+  char                **ibuf,
+  apr_size_t          *ilen,
+  char                **obuf,
+  apr_size_t          *olen);
+
 #endif
 
index 275a2cd..2f3ec9a 100644 (file)
@@ -90,7 +90,7 @@
 #define PACKAGE "mod_chxj"
 
 /* Define to the address where bug reports for this package should be sent. */
-#define PACKAGE_BUGREPORT ""
+#define PACKAGE_BUGREPORT "konn@users.sourceforge.jp"
 
 /* Define to the full name of this package. */
 #define PACKAGE_NAME "mod_chxj"
index 41e0a3f..570c0da 100644 (file)
@@ -97,14 +97,16 @@ chxj_encoding(request_rec *r, const char *src, apr_size_t *len)
     if (result == (size_t)(-1)) {
       if (E2BIG == errno) {
         ERR(r, "There is not sufficient room at *outbuf.");
+        break;
       }
       else if (EILSEQ == errno) {
-        ERR(r, "An invalid multibyte sequence has been encountered in the input. input:[%s]", ibuf);
+        ERR(r, "%s:%d An invalid multibyte sequence has been encountered in the input. input:[%s]", __FILE__,__LINE__,ibuf);
+        chxj_convert_illegal_charactor_sequence(r, entryp, &ibuf, &ilen, &obuf, &olen);
       }
       else if (EINVAL == errno) {
         ERR(r, "An incomplete multibyte sequence has been encountered in the input. input:[%s]", ibuf);
+        break;
       }
-      break;
     }
   }
   *len = strlen(spos);
@@ -115,6 +117,50 @@ chxj_encoding(request_rec *r, const char *src, apr_size_t *len)
 }
 
 
+void
+chxj_convert_illegal_charactor_sequence(request_rec *r, chxjconvrule_entry  *entryp, char **ibuf, apr_size_t *ilen, char **obuf, apr_size_t *olen)
+{
+  if (STRCASEEQ('u','U',"UTF-8", entryp->encoding) || STRCASEEQ('u','U',"UTF8", entryp->encoding)) {
+    if ((0xe0 & **ibuf) == 0xc0) {
+      /* 2byte charactor */
+      **obuf = '?';
+      *obuf += 1;
+      *olen -= 1;
+      *ibuf += 2;
+      DBG(r, "passed 2byte.");
+    }
+    else if ((0xf0 & **ibuf) == 0xe0) {
+      /* 3byte charactor */
+      **obuf = '?';
+      *obuf += 1;
+      *olen -= 1;
+      *ibuf +=3;
+      DBG(r, "passed 3byte.");
+    }
+    else if ((0xf8 & **ibuf) == 0xf0) {
+      /* 4byte charactor */
+      **obuf = '?';
+      *obuf += 1;
+      *olen -= 1;
+      *ibuf +=4;
+      DBG(r, "passed 4byte.");
+    }
+    else if ((0xc0 & **ibuf) == 0x80) {
+      /* 1byte charactor */
+      **obuf = '?';
+      *obuf += 1;
+      *olen -= 1;
+      *ibuf += 1;
+      DBG(r, "passed 1byte.");
+    }
+    if (ibuf && *ibuf) {
+      *ilen = strlen(*ibuf);
+      DBG(r, "new len = [%d].", *ilen);
+    }
+  }
+}
+
+
 char *
 chxj_rencoding(request_rec *r, const char *src, apr_size_t *len)
 {
@@ -190,14 +236,16 @@ chxj_rencoding(request_rec *r, const char *src, apr_size_t *len)
     if (result == (size_t)(-1)) {
       if (E2BIG == errno) {
         ERR(r, "There is not sufficient room at *outbuf");
+        break;
       }
       else if (EILSEQ == errno) {
         ERR(r, "An invalid multibyte sequence has been encountered in the input. input:[%s]", ibuf);
+        chxj_convert_illegal_charactor_sequence(r, entryp, &ibuf, &ilen, &obuf, &olen);
       }
       else if (EINVAL == errno) {
         ERR(r, "An incomplete multibyte sequence has been encountered in the input. input:[%s]", ibuf);
+        break;
       }
-      break;
     }
   }