From b71c9044ff0b7ae6c3f22fea2cd01db23b126aec Mon Sep 17 00:00:00 2001 From: konn Date: Mon, 4 Feb 2008 11:25:20 +0000 Subject: [PATCH] * merge from 0.8.3 * Added sample site code. git-svn-id: svn+ssh://svn.sourceforge.jp/svnroot/modchxj/mod_chxj/trunk@1826 1a406e8e-add9-4483-a2c8-d8cac5b7c224 --- ChangeLog | 16 +++++ Makefile.in | 3 + configure | 156 +++++++++++++++++++++++++++------------- configure.ac | 28 +++++--- debian/changelog | 16 +++++ include/chxj_img_conv_format.h | 3 + include/mod_chxj.h | 1 + sample_site/sjis/get1_sjis.php | 34 +++++++++ sample_site/sjis/index.php | 9 +-- sample_site/sjis/post1_sjis.php | 2 +- src/Makefile.in | 3 + src/chxj_img_conv_format.c | 124 ++++++++++++++++++++++++++++++-- src/mod_chxj.c | 49 +++++++++---- 13 files changed, 362 insertions(+), 82 deletions(-) create mode 100755 sample_site/sjis/get1_sjis.php diff --git a/ChangeLog b/ChangeLog index f4119ee5..049cc57a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,19 @@ +libapache2-mod-chxj (0.8.3-1) unstable; urgency=high + + * Fixed Bug + - The image conversion is not operated at the access by PC. + - Bug that doesn't delete cache file. + + default limit size is 10MByte. + but the setting cannot be changed now. + + -- Atsushi Konno Mon, 4 Feb 2008 12:53:21 +0900 + +libapache2-mod-chxj (0.8.2-1) unstable; urgency=low + + * Fixed Bug to which compile error occurs when A is specified. + + -- Atsushi Konno Sun, 3 Feb 2008 01:40:33 +0900 + libapache2-mod-chxj (0.8.1-1) unstable; urgency=low * Changed for Apache 2.2.x. diff --git a/Makefile.in b/Makefile.in index 5b80d0a2..27ee37ff 100644 --- a/Makefile.in +++ b/Makefile.in @@ -77,9 +77,12 @@ ACLOCAL = @ACLOCAL@ AMDEP_FALSE = @AMDEP_FALSE@ AMDEP_TRUE = @AMDEP_TRUE@ AMTAR = @AMTAR@ +APR_1_CONFIG = @APR_1_CONFIG@ APR_CONFIG = @APR_CONFIG@ +APU_1_CONFIG = @APU_1_CONFIG@ APU_CONFIG = @APU_CONFIG@ APXS = @APXS@ +APXS2 = @APXS2@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ diff --git a/configure b/configure index 5d703169..2238555f 100755 --- a/configure +++ b/configure @@ -872,9 +872,12 @@ FFLAGS ac_ct_F77 LIBTOOL APXS +APXS2 WAND_CONFIG APR_CONFIG +APR_1_CONFIG APU_CONFIG +APU_1_CONFIG with_apache_header QDEFS DDEFS @@ -5443,7 +5446,7 @@ ia64-*-hpux*) ;; *-*-irix6*) # Find out which ABI we are using. - echo '#line 5446 "configure"' > conftest.$ac_ext + echo '#line 5449 "configure"' > conftest.$ac_ext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? @@ -7940,11 +7943,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:7943: $lt_compile\"" >&5) + (eval echo "\"\$as_me:7946: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:7947: \$? = $ac_status" >&5 + echo "$as_me:7950: \$? = $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. @@ -8208,11 +8211,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:8211: $lt_compile\"" >&5) + (eval echo "\"\$as_me:8214: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:8215: \$? = $ac_status" >&5 + echo "$as_me:8218: \$? = $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. @@ -8312,11 +8315,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:8315: $lt_compile\"" >&5) + (eval echo "\"\$as_me:8318: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:8319: \$? = $ac_status" >&5 + echo "$as_me:8322: \$? = $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 @@ -10609,7 +10612,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext < conftest.$ac_ext <&5) + (eval echo "\"\$as_me:13051: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:13052: \$? = $ac_status" >&5 + echo "$as_me:13055: \$? = $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. @@ -13149,11 +13152,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:13152: $lt_compile\"" >&5) + (eval echo "\"\$as_me:13155: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:13156: \$? = $ac_status" >&5 + echo "$as_me:13159: \$? = $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 @@ -14710,11 +14713,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:14713: $lt_compile\"" >&5) + (eval echo "\"\$as_me:14716: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:14717: \$? = $ac_status" >&5 + echo "$as_me:14720: \$? = $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. @@ -14814,11 +14817,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:14817: $lt_compile\"" >&5) + (eval echo "\"\$as_me:14820: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:14821: \$? = $ac_status" >&5 + echo "$as_me:14824: \$? = $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 @@ -17001,11 +17004,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:17004: $lt_compile\"" >&5) + (eval echo "\"\$as_me:17007: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:17008: \$? = $ac_status" >&5 + echo "$as_me:17011: \$? = $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. @@ -17269,11 +17272,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:17272: $lt_compile\"" >&5) + (eval echo "\"\$as_me:17275: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:17276: \$? = $ac_status" >&5 + echo "$as_me:17279: \$? = $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. @@ -17373,11 +17376,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:17376: $lt_compile\"" >&5) + (eval echo "\"\$as_me:17379: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:17380: \$? = $ac_status" >&5 + echo "$as_me:17383: \$? = $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 @@ -20248,11 +20251,58 @@ fi if test "x$APXS" = "xno"; then - { { echo "$as_me:$LINENO: error: apxs not found." >&5 + # Extract the first word of "apxs2", so it can be a program name with args. +set dummy apxs2; ac_word=$2 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_path_APXS2+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + case $APXS2 in + [\\/]* | ?:[\\/]*) + ac_cv_path_APXS2="$APXS2" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +as_dummy="/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:/usr/local/apache/bin" +for as_dir in $as_dummy +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_path_APXS2="$as_dir/$ac_word$ac_exec_ext" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + + test -z "$ac_cv_path_APXS2" && ac_cv_path_APXS2="no" + ;; +esac +fi +APXS2=$ac_cv_path_APXS2 +if test -n "$APXS2"; then + { echo "$as_me:$LINENO: result: $APXS2" >&5 +echo "${ECHO_T}$APXS2" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + + + if test "x$APXS2" = "xno" ; then + { { echo "$as_me:$LINENO: error: apxs not found." >&5 echo "$as_me: error: apxs not found." >&2;} { (exit 1); exit 1; }; } + fi fi fi +if test "x$APXS2" != "x" ; then + APXS="$APXS2" +fi if test "x$with_apxs" != "x" ; then APXS=$with_apxs fi @@ -20403,12 +20453,12 @@ fi set dummy apr-1-config; ac_word=$2 { echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } -if test "${ac_cv_path_APR_CONFIG+set}" = set; then +if test "${ac_cv_path_APR_1_CONFIG+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - case $APR_CONFIG in + case $APR_1_CONFIG in [\\/]* | ?:[\\/]*) - ac_cv_path_APR_CONFIG="$APR_CONFIG" # Let the user override the test with a path. + ac_cv_path_APR_1_CONFIG="$APR_1_CONFIG" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR @@ -20419,7 +20469,7 @@ do test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_path_APR_CONFIG="$as_dir/$ac_word$ac_exec_ext" + ac_cv_path_APR_1_CONFIG="$as_dir/$ac_word$ac_exec_ext" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi @@ -20427,24 +20477,26 @@ done done IFS=$as_save_IFS - test -z "$ac_cv_path_APR_CONFIG" && ac_cv_path_APR_CONFIG="no" + test -z "$ac_cv_path_APR_1_CONFIG" && ac_cv_path_APR_1_CONFIG="no" ;; esac fi -APR_CONFIG=$ac_cv_path_APR_CONFIG -if test -n "$APR_CONFIG"; then - { echo "$as_me:$LINENO: result: $APR_CONFIG" >&5 -echo "${ECHO_T}$APR_CONFIG" >&6; } +APR_1_CONFIG=$ac_cv_path_APR_1_CONFIG +if test -n "$APR_1_CONFIG"; then + { echo "$as_me:$LINENO: result: $APR_1_CONFIG" >&5 +echo "${ECHO_T}$APR_1_CONFIG" >&6; } else { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } fi - if test "x$APR_CONFIG" = "xno" ; then - { { echo "$as_me:$LINENO: error: apr-config not found." >&5 -echo "$as_me: error: apr-config not found." >&2;} + if test "x$APR_1_CONFIG" = "xno" ; then + { { echo "$as_me:$LINENO: error: apr-config and apr-1-config not found." >&5 +echo "$as_me: error: apr-config and apr-1-config not found." >&2;} { (exit 1); exit 1; }; } + else + APR_CONFIG="$APR_1_CONFIG" fi fi fi @@ -20500,12 +20552,12 @@ fi set dummy apu-1-config; ac_word=$2 { echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } -if test "${ac_cv_path_APU_CONFIG+set}" = set; then +if test "${ac_cv_path_APU_1_CONFIG+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - case $APU_CONFIG in + case $APU_1_CONFIG in [\\/]* | ?:[\\/]*) - ac_cv_path_APU_CONFIG="$APU_CONFIG" # Let the user override the test with a path. + ac_cv_path_APU_1_CONFIG="$APU_1_CONFIG" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR @@ -20516,7 +20568,7 @@ do test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_path_APU_CONFIG="$as_dir/$ac_word$ac_exec_ext" + ac_cv_path_APU_1_CONFIG="$as_dir/$ac_word$ac_exec_ext" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi @@ -20524,24 +20576,26 @@ done done IFS=$as_save_IFS - test -z "$ac_cv_path_APU_CONFIG" && ac_cv_path_APU_CONFIG="no" + test -z "$ac_cv_path_APU_1_CONFIG" && ac_cv_path_APU_1_CONFIG="no" ;; esac fi -APU_CONFIG=$ac_cv_path_APU_CONFIG -if test -n "$APU_CONFIG"; then - { echo "$as_me:$LINENO: result: $APU_CONFIG" >&5 -echo "${ECHO_T}$APU_CONFIG" >&6; } +APU_1_CONFIG=$ac_cv_path_APU_1_CONFIG +if test -n "$APU_1_CONFIG"; then + { echo "$as_me:$LINENO: result: $APU_1_CONFIG" >&5 +echo "${ECHO_T}$APU_1_CONFIG" >&6; } else { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } fi - if test "x$APU_CONFIG" = "xno" ; then - { { echo "$as_me:$LINENO: error: apu-config not found." >&5 -echo "$as_me: error: apu-config not found." >&2;} + if test "x$APU_1_CONFIG" = "xno" ; then + { { echo "$as_me:$LINENO: error: apu-config and apu-1-config not found." >&5 +echo "$as_me: error: apu-config and apu-1-config not found." >&2;} { (exit 1); exit 1; }; } + else + APU_CONFIG="$APU_1_CONFIG" fi fi fi @@ -20550,6 +20604,7 @@ if test "x$with_apu_config" != "x" ; then fi + # Check whether --with-iconv was given. if test "${with_iconv+set}" = set; then withval=$with_iconv; @@ -22848,9 +22903,12 @@ FFLAGS!$FFLAGS$ac_delim ac_ct_F77!$ac_ct_F77$ac_delim LIBTOOL!$LIBTOOL$ac_delim APXS!$APXS$ac_delim +APXS2!$APXS2$ac_delim WAND_CONFIG!$WAND_CONFIG$ac_delim APR_CONFIG!$APR_CONFIG$ac_delim +APR_1_CONFIG!$APR_1_CONFIG$ac_delim APU_CONFIG!$APU_CONFIG$ac_delim +APU_1_CONFIG!$APU_1_CONFIG$ac_delim with_apache_header!$with_apache_header$ac_delim QDEFS!$QDEFS$ac_delim DDEFS!$DDEFS$ac_delim @@ -22858,7 +22916,7 @@ LIBOBJS!$LIBOBJS$ac_delim LTLIBOBJS!$LTLIBOBJS$ac_delim _ACEOF - if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 16; then + if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 19; then break elif $ac_last_try; then { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5 diff --git a/configure.ac b/configure.ac index df9c64e7..fdab0d35 100644 --- a/configure.ac +++ b/configure.ac @@ -78,11 +78,18 @@ fi if test "x$with_apxs" = "x" ; then AC_PATH_PROG(APXS, apxs, no, - /usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:/usr/local/apache/bin) + /usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:/usr/local/apache/bin) if test "x$APXS" = "xno"; then - AC_MSG_ERROR([apxs not found.]) + AC_PATH_PROG(APXS2, apxs2, no, + /usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:/usr/local/apache/bin) + if test "x$APXS2" = "xno" ; then + AC_MSG_ERROR([apxs not found.]) + fi fi fi +if test "x$APXS2" != "x" ; then + APXS="$APXS2" +fi if test "x$with_apxs" != "x" ; then APXS=$with_apxs fi @@ -104,9 +111,11 @@ fi if test "x$with_apr_config" = "x" ; then AC_PATH_PROG(APR_CONFIG, apr-config, no, /usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin) if test "x$APR_CONFIG" = "xno" ; then - AC_PATH_PROG(APR_CONFIG, apr-1-config, no, /usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin) - if test "x$APR_CONFIG" = "xno" ; then - AC_MSG_ERROR([apr-config not found.]) + AC_PATH_PROG(APR_1_CONFIG, apr-1-config, no, /usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin) + if test "x$APR_1_CONFIG" = "xno" ; then + AC_MSG_ERROR([apr-config and apr-1-config not found.]) + else + APR_CONFIG="$APR_1_CONFIG" fi fi fi @@ -117,9 +126,11 @@ fi if test "x$with_apu_config" = "x" ; then AC_PATH_PROG(APU_CONFIG, apu-config, no, /usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin) if test "x$APU_CONFIG" = "xno" ; then - AC_PATH_PROG(APU_CONFIG, apu-1-config, no, /usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin) - if test "x$APU_CONFIG" = "xno" ; then - AC_MSG_ERROR([apu-config not found.]) + AC_PATH_PROG(APU_1_CONFIG, apu-1-config, no, /usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin) + if test "x$APU_1_CONFIG" = "xno" ; then + AC_MSG_ERROR([apu-config and apu-1-config not found.]) + else + APU_CONFIG="$APU_1_CONFIG" fi fi fi @@ -127,6 +138,7 @@ if test "x$with_apu_config" != "x" ; then APU_CONFIG=$with_apu_config fi + AC_ARG_WITH(iconv, [ --with-iconv=ARG specify the place of the libiconv directory.]) AC_ARG_WITH(iconv_hook, [ --with-iconv_hook=ARG specify the place of the libiconv_hook directory.]) if test "x$with_iconv" = "x" -a "x$with_iconv_hook" = "x" ; then diff --git a/debian/changelog b/debian/changelog index 206f08cd..d96260a4 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,19 @@ +libapache2-mod-chxj (0.8.3-1) unstable; urgency=high + + * Fixed Bug + - The image conversion is not operated at the access by PC. + - Bug that doesn't erase cache file. + + default limit size is 10MByte. + but the setting cannot be changed now. + + -- Atsushi Konno Mon, 4 Feb 2008 12:53:21 +0900 + +libapache2-mod-chxj (0.8.2-1) unstable; urgency=low + + * Fixed Bug to which compile error occurs when A is specified. + + -- Atsushi Konno Sun, 3 Feb 2008 01:40:33 +0900 + libapache2-mod-chxj (0.8.1-1) unstable; urgency=low * fix warning. diff --git a/include/chxj_img_conv_format.h b/include/chxj_img_conv_format.h index 9ec09056..d6801581 100644 --- a/include/chxj_img_conv_format.h +++ b/include/chxj_img_conv_format.h @@ -20,6 +20,9 @@ #define DEFAULT_IMAGE_CACHE_DIR "/tmp" +/* default: 10MByte */ +#define DEFAULT_IMAGE_CACHE_LIMIT (10*1024*1024) + extern int chxj_img_conv_format_handler( request_rec* r); diff --git a/include/mod_chxj.h b/include/mod_chxj.h index 40fc9dc8..732102fc 100644 --- a/include/mod_chxj.h +++ b/include/mod_chxj.h @@ -303,6 +303,7 @@ struct mod_chxj_config { char *image_cache_dir; char *image_copyright; + unsigned long image_cache_limit; device_table_list *devices; emoji_t *emoji; emoji_t *emoji_tail; diff --git a/sample_site/sjis/get1_sjis.php b/sample_site/sjis/get1_sjis.php new file mode 100755 index 00000000..a391adfe --- /dev/null +++ b/sample_site/sjis/get1_sjis.php @@ -0,0 +1,34 @@ + + + + + + +
+ŠG•¶Žš“ü—Í‚ÌýÄ(SJIS‚ÅGET) +
+
+
+ + +
+¹Þ¯Ä‚³‚ꂽ’l‚́AAA
+[ +"; + echo "BIN:[" . $data . "]
"; +?> +‚Å‚·B
+ +
+ +
+ù‡–ß‚é
+ + diff --git a/sample_site/sjis/index.php b/sample_site/sjis/index.php index 3be8aa5d..efdb29f6 100644 --- a/sample_site/sjis/index.php +++ b/sample_site/sjis/index.php @@ -11,11 +11,12 @@ header("Pragma: no-cache"); ŠG•¶ŽšÃ½Ä(SJIS)
-ùˆŠG•¶Žš“ü—Í‚ÌýÄ
+ùˆŠG•¶Žš“ü—Í‚ÌýÄ(POST)
+ù‰ŠG•¶Žš“ü—Í‚ÌýÄ(GET)

-ù‰16iŽQÆ•¶Žš—ñŠG•¶•\Ž¦Ã½Ä
-ùŠ10iŽQÆ•¶Žš—ñŠG•¶•\Ž¦Ã½Ä
-ù‹ÊÞ²Å؊G•¶•\Ž¦Ã½Ä
+ùŠ16iŽQÆ•¶Žš—ñŠG•¶•\Ž¦Ã½Ä
+ù‹10iŽQÆ•¶Žš—ñŠG•¶•\Ž¦Ã½Ä
+ùŒÊÞ²Å؊G•¶•\Ž¦Ã½Ä

ù‡–ß‚é
ùÄ¯Ì߂Ö
diff --git a/sample_site/sjis/post1_sjis.php b/sample_site/sjis/post1_sjis.php index cd27d036..9894b787 100644 --- a/sample_site/sjis/post1_sjis.php +++ b/sample_site/sjis/post1_sjis.php @@ -11,7 +11,7 @@ header("Pragma: no-cache"); $data = $_POST["øŸ"]; ?>
-ŠG•¶Žš“ü—Í‚ÌýÄ(SJIS) +ŠG•¶Žš“ü—Í‚ÌýÄ(SJIS‚ÅPOST)

diff --git a/src/Makefile.in b/src/Makefile.in index 32af7800..e60e9aef 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -98,9 +98,12 @@ ACLOCAL = @ACLOCAL@ AMDEP_FALSE = @AMDEP_FALSE@ AMDEP_TRUE = @AMDEP_TRUE@ AMTAR = @AMTAR@ +APR_1_CONFIG = @APR_1_CONFIG@ APR_CONFIG = @APR_CONFIG@ +APU_1_CONFIG = @APU_1_CONFIG@ APU_CONFIG = @APU_CONFIG@ APXS = @APXS@ +APXS2 = @APXS2@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ diff --git a/src/chxj_img_conv_format.c b/src/chxj_img_conv_format.c index 30e1c2c9..c31c4d96 100644 --- a/src/chxj_img_conv_format.c +++ b/src/chxj_img_conv_format.c @@ -24,6 +24,8 @@ #include "chxj_url_encode.h" #include "qs_parse_string.h" +#include + #include "http_core.h" #include @@ -171,13 +173,17 @@ static apr_status_t s_create_cache_file(request_rec *r, const char *tmpfile, device_table *spec, apr_finfo_t *st, - query_string_param_t *qsp); + query_string_param_t* qsp, + mod_chxj_config *conf); static apr_status_t s_send_cache_file( device_table *spec, query_string_param_t *query_string, request_rec *r, const char *tmpfile); +static apr_status_t s_send_original_file(request_rec* r, + const char* originalfile); + static apr_status_t s_header_only_cache_file(device_table *spec, query_string_param_t *query_string, request_rec *r, @@ -372,6 +378,13 @@ s_img_conv_format_from_file( apr_finfo_t cache_st; char *tmpfile; + if (spec->html_spec_type == CHXJ_SPEC_UNKNOWN) { + /* + * If ``ua'' parameter is specified, it must be CHXJ_SPEC_HTML. + */ + return s_send_original_file(r, r->filename); + } + /*--------------------------------------------------------------------------*/ /* Create Workfile Name */ /*--------------------------------------------------------------------------*/ @@ -392,7 +405,7 @@ s_img_conv_format_from_file( /* It tries to make the cash file when it doesn't exist or there is */ /* change time later since the making time of the cash file. */ /*------------------------------------------------------------------------*/ - rv = s_create_cache_file(r,tmpfile, spec, &st, qsp); + rv = s_create_cache_file(r,tmpfile, spec, &st, qsp, conf); if (rv != OK) return rv; } @@ -417,11 +430,12 @@ s_img_conv_format_from_file( static apr_status_t -s_create_cache_file(request_rec *r, - const char *tmpfile, - device_table *spec, - apr_finfo_t *st, - query_string_param_t *qsp) +s_create_cache_file(request_rec *r, + const char *tmpfile, + device_table *spec, + apr_finfo_t *st, + query_string_param_t *qsp, + mod_chxj_config *conf) { apr_status_t rv; apr_size_t readbyte; @@ -437,6 +451,8 @@ s_create_cache_file(request_rec *r, MagickWand *magick_wand; + apr_finfo_t cache_dir_st; + if ((*r->handler == 'c' || *r->handler == 'C') && strcasecmp(r->handler, "chxj-qrcode") == 0) { /*------------------------------------------------------------------------*/ @@ -674,6 +690,71 @@ s_create_cache_file(request_rec *r, } DBG(r, "end convert and compression"); + + /* check limit */ + rv = apr_stat(&cache_dir_st, conf->image_cache_dir, APR_FINFO_MIN, r->pool); + if (rv != APR_SUCCESS) { + DestroyMagickWand(magick_wand); + ERR(r,"dir stat error.[%s]", conf->image_cache_dir); + return HTTP_INTERNAL_SERVER_ERROR; + } + + for (;;) { + /* delete candidate */ + apr_finfo_t dcf; + /* get dir files size */ + apr_dir_t *dir; + unsigned long total_size = 0; + int found_file = 0; + unsigned long max_size = (! conf->image_cache_limit) ? DEFAULT_IMAGE_CACHE_LIMIT : conf->image_cache_limit; + char *delete_file_name; + + rv = apr_dir_open(&dir, conf->image_cache_dir, r->pool); + if (rv != APR_SUCCESS) { + DestroyMagickWand(magick_wand); + ERR(r,"dir open error.[%s]", conf->image_cache_dir); + return HTTP_INTERNAL_SERVER_ERROR; + } + memset(&dcf, 0, sizeof(apr_finfo_t)); + dcf.atime = (apr_time_t)LONG_LONG_MAX; + for (;;) { + apr_finfo_t dirf; + rv = apr_dir_read(&dirf, APR_FINFO_SIZE|APR_FINFO_NAME|APR_FINFO_DIRENT|APR_FINFO_ATIME , dir); + if (rv != APR_SUCCESS) { + break; + } + if (dirf.name && strcmp(dirf.name, ".") != 0 && strcmp(dirf.name, "..") != 0) { + total_size += (unsigned long)dirf.size; + DBG(r, "dirf.name=[%s] dirf.size=[%ld] dirf.atime=[%lld]", + dirf.name, (long)dirf.size, (long long int)dirf.atime); + if (dcf.atime >= dirf.atime) { + memcpy(&dcf, &dirf, sizeof(apr_finfo_t)); + } + found_file++; + } + } + apr_dir_close(dir); + if (total_size + writebyte < max_size || found_file == 0) { + DBG(r, "There is an enough size in cache. total_size:[%lu] max_size:[%lu] found_file=[%d]", + total_size, max_size, found_file); + break; + } + DBG(r, "Image Cache dir is full. total_size:[%lu] max_size:[%lu]", + total_size + writebyte, max_size); + /* search delete candidate */ + delete_file_name = apr_psprintf(r->pool, "%s/%s", conf->image_cache_dir, dcf.name); + DBG(r, "delete image cache target:[%s] atime:[%lld]", delete_file_name, dcf.atime); + rv = apr_file_remove(delete_file_name, r->pool); + if (rv != APR_SUCCESS) { + ERR(r, "cache file delete failure.[%s]", delete_file_name); + return HTTP_INTERNAL_SERVER_ERROR; + } + DBG(r, "deleted image cache target:[%s]", delete_file_name); + if (total_size + writebyte - dcf.size < max_size) { + DBG(r, "OK, there is an enough size in cache."); + break; + } + } /* to cache */ rv = apr_file_open(&fout, tmpfile, @@ -1462,6 +1543,35 @@ s_send_cache_file( return OK; } + +static apr_status_t +s_send_original_file(request_rec* r, const char* originalfile) +{ + apr_status_t rv; + apr_finfo_t st; + apr_file_t* fout; + apr_size_t sendbyte = 0; + + rv = apr_stat(&st, originalfile, APR_FINFO_MIN, r->pool); + if (rv != APR_SUCCESS) + return HTTP_NOT_FOUND; + + rv = apr_file_open(&fout, originalfile, + APR_READ | APR_BINARY, APR_OS_DEFAULT, r->pool); + if (rv != APR_SUCCESS) { + DBG(r, "originalfile open failed[%s]", originalfile); + return HTTP_NOT_FOUND; + } + + ap_send_fd(fout, r, 0, st.size, &sendbyte); + apr_file_close(fout); + ap_rflush(r); + DBG(r, "send file data[%d]byte", (int)sendbyte); + + return OK; +} + + static apr_status_t s_header_only_cache_file( device_table *spec, diff --git a/src/mod_chxj.c b/src/mod_chxj.c index 040d543b..2abf7d15 100644 --- a/src/mod_chxj.c +++ b/src/mod_chxj.c @@ -198,7 +198,7 @@ chxj_headers_fixup(request_rec *r) * @param len [i/o] It is length of former HTML character string. */ static char * -chxj_exchange(request_rec *r, const char **src, apr_size_t *len) +chxj_exchange(request_rec *r, const char** src, apr_size_t* len, device_table *spec, const char *ua) { char *user_agent; char *dst; @@ -236,7 +236,10 @@ chxj_exchange(request_rec *r, const char **src, apr_size_t *len) return (char*)*src; } - device_table* spec = chxj_specified_device(r, user_agent); + if (ua && user_agent && strcasecmp(user_agent, ua) != 0) { + /* again */ + spec = chxj_specified_device(r, user_agent); + } /* * save cookie. @@ -668,6 +671,7 @@ chxj_output_filter(ap_filter_t *f, apr_bucket_brigade *bb) apr_status_t rv; apr_bucket *b; const char *data; + char *user_agent; char *contentLength; apr_size_t len; mod_chxj_ctx *ctx; @@ -675,6 +679,7 @@ chxj_output_filter(ap_filter_t *f, apr_bucket_brigade *bb) char *location_header; mod_chxj_config *dconf; chxjconvrule_entry *entryp; + device_table *spec; @@ -690,8 +695,10 @@ chxj_output_filter(ap_filter_t *f, apr_bucket_brigade *bb) f->r->chunked = 1; } - dconf = ap_get_module_config(r->per_dir_config, &chxj_module); - entryp = chxj_apply_convrule(r, dconf->convrules); + dconf = ap_get_module_config(r->per_dir_config, &chxj_module); + entryp = chxj_apply_convrule(r, dconf->convrules); + user_agent = (char*)apr_table_get(r->headers_in, HTTP_USER_AGENT); + spec = chxj_specified_device(r, user_agent); for (b = APR_BRIGADE_FIRST(bb); b != APR_BRIGADE_SENTINEL(bb); @@ -709,9 +716,10 @@ chxj_output_filter(ap_filter_t *f, apr_bucket_brigade *bb) DBG(r, "content_type=[%s]", r->content_type); - if (r->content_type - && *(char*)r->content_type == 't' - && strncmp(r->content_type, "text/html", 9) == 0) { + if (spec->html_spec_type != CHXJ_SPEC_UNKNOWN + && r->content_type + && *(char*)r->content_type == 't' + && strncmp(r->content_type, "text/html", 9) == 0) { if (ctx->len) { char* tmp; @@ -727,7 +735,9 @@ chxj_output_filter(ap_filter_t *f, apr_bucket_brigade *bb) ctx->buffer = chxj_exchange(r, (const char**)&tmp, - (apr_size_t*)&ctx->len); + (apr_size_t*)&ctx->len, + spec, + user_agent); #if 1 DBG(r, "output data=[%.*s]", ctx->len,ctx->buffer); @@ -738,13 +748,15 @@ chxj_output_filter(ap_filter_t *f, apr_bucket_brigade *bb) ctx->len += 1; ctx->buffer = chxj_exchange(r, (const char**)&ctx->buffer, - (apr_size_t*)&ctx->len); + (apr_size_t*)&ctx->len, + spec, + user_agent); } } if (r->content_type - && *(char*)r->content_type == 't' - && strncmp(r->content_type, "text/xml", 8) == 0) { + && *(char*)r->content_type == 't' + && strncmp(r->content_type, "text/xml", 8) == 0) { DBG(r, "text/XML"); Doc doc; @@ -791,8 +803,9 @@ chxj_output_filter(ap_filter_t *f, apr_bucket_brigade *bb) } } - if (r->content_type - && *(char*)r->content_type == 'i' + if (spec->html_spec_type != CHXJ_SPEC_UNKNOWN + && r->content_type + && *(char*)r->content_type == 'i' && strncmp(r->content_type, "image/", 6) == 0) { if (ctx->len) { char *tmp; @@ -1262,9 +1275,11 @@ chxj_create_per_dir_config(apr_pool_t *p, char *arg) conf->emoji_tail = NULL; conf->image = CHXJ_IMG_OFF; conf->image_cache_dir = apr_psprintf(p, "%s",DEFAULT_IMAGE_CACHE_DIR); + conf->image_cache_limit = 0; conf->server_side_encoding = NULL; conf->cookie_db_dir = NULL; conf->cookie_timeout = 0; + conf->image_cache_limit = DEFAULT_IMAGE_CACHE_LIMIT; if (arg == NULL) { conf->dir = NULL; @@ -1303,6 +1318,7 @@ chxj_merge_per_dir_config(apr_pool_t *p, void *basev, void *addv) mrg->image = CHXJ_IMG_OFF; mrg->image_cache_dir = NULL; mrg->image_copyright = NULL; + mrg->image_cache_limit = 0; mrg->emoji = NULL; mrg->emoji_tail = NULL; mrg->ezweb2imode = NULL; @@ -1353,6 +1369,13 @@ chxj_merge_per_dir_config(apr_pool_t *p, void *basev, void *addv) else mrg->image_cache_dir = apr_pstrdup(p, add->image_cache_dir); + if (add->image_cache_limit) { + mrg->image_cache_limit = add->image_cache_limit; + } + else { + mrg->image_cache_limit = base->image_cache_limit; + } + if (add->image_copyright) mrg->image_copyright = apr_pstrdup(p, add->image_copyright); else -- 2.11.0