OSDN Git Service

Merge branch 'branch_0.12.0' into branch_0.12.0-svn
authorkonn <konn@1a406e8e-add9-4483-a2c8-d8cac5b7c224>
Mon, 8 Dec 2008 12:04:43 +0000 (12:04 +0000)
committerkonn <konn@1a406e8e-add9-4483-a2c8-d8cac5b7c224>
Mon, 8 Dec 2008 12:04:43 +0000 (12:04 +0000)
git-svn-id: svn+ssh://svn.sourceforge.jp/svnroot/modchxj/mod_chxj/branches/RELEASE_0_12_0@4584 1a406e8e-add9-4483-a2c8-d8cac5b7c224

12 files changed:
include/chxj_header_inf.h [new file with mode: 0644]
src/Makefile.am
src/Makefile.in
src/chxj_chtml10.c
src/chxj_chtml20.c
src/chxj_chtml30.c
src/chxj_chtml40.c
src/chxj_chtml50.c
src/chxj_header_inf.c [new file with mode: 0644]
src/chxj_jhtml.c
src/chxj_jxhtml.c
src/chxj_xhtml_mobile_1_0.c

diff --git a/include/chxj_header_inf.h b/include/chxj_header_inf.h
new file mode 100644 (file)
index 0000000..08bcbca
--- /dev/null
@@ -0,0 +1,27 @@
+/*
+ * 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.
+ */
+#ifndef __CHXJ_HEADER_INF_H__
+#define __CHXJ_HEADER_INF_H__
+
+#include "mod_chxj.h"
+
+#define HTTP_X_CHXJ_SET_CONTENT_TYPE   "X-Chxj-Set-Content-Type"
+
+
+extern char *chxj_header_inf_set_content_type(request_rec *r, char *default_string);
+
+#endif
index f825a3b..12f13bd 100644 (file)
@@ -40,7 +40,8 @@ libmod_chxj_la_SOURCES = mod_chxj.c \
     chxj_apache.c \
     chxj_add_device_env.c \
     chxj_serf.c \
-    chxj_conv_z2h.c
+    chxj_conv_z2h.c \
+    chxj_header_inf.c
 
 
 libmod_chxj_la_CFLAGS = -O2 -prefer-pic @QDEFS@ @DDEFS@ -I. -I../include -I@with_apache_header@  -I./serf
index 2f14426..59217e8 100644 (file)
@@ -80,7 +80,8 @@ am_libmod_chxj_la_OBJECTS = libmod_chxj_la-mod_chxj.lo \
        libmod_chxj_la-chxj_buffered_write.lo \
        libmod_chxj_la-chxj_apache.lo \
        libmod_chxj_la-chxj_add_device_env.lo \
-       libmod_chxj_la-chxj_serf.lo libmod_chxj_la-chxj_conv_z2h.lo
+       libmod_chxj_la-chxj_serf.lo libmod_chxj_la-chxj_conv_z2h.lo \
+       libmod_chxj_la-chxj_header_inf.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) \
@@ -265,7 +266,8 @@ libmod_chxj_la_SOURCES = mod_chxj.c \
     chxj_apache.c \
     chxj_add_device_env.c \
     chxj_serf.c \
-    chxj_conv_z2h.c
+    chxj_conv_z2h.c \
+    chxj_header_inf.c
 
 libmod_chxj_la_CFLAGS = -O2 -prefer-pic @QDEFS@ @DDEFS@ -I. -I../include -I@with_apache_header@  -I./serf
 AM_CFLAGS = @CFLAGS@ -O2 -prefer-pic @QDEFS@ @DDEFS@ -I. -I../include -I@with_apache_header@
@@ -356,6 +358,7 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmod_chxj_la-chxj_dump.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmod_chxj_la-chxj_encoding.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmod_chxj_la-chxj_hdml.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmod_chxj_la-chxj_header_inf.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmod_chxj_la-chxj_img_conv.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmod_chxj_la-chxj_img_conv_format.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmod_chxj_la-chxj_jhtml.Plo@am__quote@
@@ -690,6 +693,13 @@ libmod_chxj_la-chxj_conv_z2h.lo: chxj_conv_z2h.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_conv_z2h.lo `test -f 'chxj_conv_z2h.c' || echo '$(srcdir)/'`chxj_conv_z2h.c
 
+libmod_chxj_la-chxj_header_inf.lo: chxj_header_inf.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_header_inf.lo -MD -MP -MF $(DEPDIR)/libmod_chxj_la-chxj_header_inf.Tpo -c -o libmod_chxj_la-chxj_header_inf.lo `test -f 'chxj_header_inf.c' || echo '$(srcdir)/'`chxj_header_inf.c
+@am__fastdepCC_TRUE@   mv -f $(DEPDIR)/libmod_chxj_la-chxj_header_inf.Tpo $(DEPDIR)/libmod_chxj_la-chxj_header_inf.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='chxj_header_inf.c' object='libmod_chxj_la-chxj_header_inf.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_header_inf.lo `test -f 'chxj_header_inf.c' || echo '$(srcdir)/'`chxj_header_inf.c
+
 mostlyclean-libtool:
        -rm -f *.lo
 
index 7491179..24fee66 100644 (file)
@@ -23,6 +23,7 @@
 #include "chxj_encoding.h"
 #include "chxj_buffered_write.h"
 #include "chxj_str_util.h"
+#include "chxj_header_inf.h"
 
 #define GET_CHTML10(X) ((chtml10_t *)(X))
 #undef W_L
@@ -440,7 +441,7 @@ chxj_convert_chtml10(
   chtml10.entryp    = entryp;
   chtml10.cookie    = cookie;
 
-  chxj_set_content_type(r, "text/html; charset=Windows-31J");
+  chxj_set_content_type(r, chxj_header_inf_set_content_type(r, "text/html; charset=Windows-31J"));
 
   /*--------------------------------------------------------------------------*/
   /* The character string of the input is analyzed.                           */
index 085ccc8..3424c52 100644 (file)
@@ -22,6 +22,7 @@
 #include "chxj_qr_code.h"
 #include "chxj_encoding.h"
 #include "chxj_buffered_write.h"
+#include "chxj_header_inf.h"
 
 
 #define GET_CHTML20(X) ((chtml20_t*)(X))
@@ -440,7 +441,7 @@ chxj_convert_chtml20(
   chtml20.entryp = entryp;
   chtml20.cookie = cookie;
 
-  chxj_set_content_type(r, "text/html; charset=Windows-31J");
+  chxj_set_content_type(r, chxj_header_inf_set_content_type(r, "text/html; charset=Windows-31J"));
 
   /*--------------------------------------------------------------------------*/
   /* The character string of the input is analyzed.                           */
@@ -677,7 +678,9 @@ s_chtml20_start_meta_tag(void *pdoc, Node *node)
         if (content_type_flag) {
           W_L(" ");
           W_V(name);
-          W_L("=\"text/html; charset=Windows-31J\"");
+          W_L("=\"");
+          W_V(chxj_header_inf_set_content_type(r, "text/html; charset=SHIFT_JIS"));
+          W_L("\"");
         }
         else if (refresh_flag) {
           char *buf = apr_pstrdup(r->pool, value);
index 62db025..75f1416 100644 (file)
@@ -22,6 +22,7 @@
 #include "chxj_img_conv.h"
 #include "chxj_qr_code.h"
 #include "chxj_encoding.h"
+#include "chxj_header_inf.h"
 
 #define GET_CHTML30(X) ((chtml30_t *)(X))
 #undef W_L
@@ -441,7 +442,7 @@ chxj_convert_chtml30(
   chtml30.entryp = entryp;
   chtml30.cookie = cookie;
 
-  chxj_set_content_type(r, "text/html; charset=Windows-31J");
+  chxj_set_content_type(r, chxj_header_inf_set_content_type(r, "text/html; charset=Windows-31J"));
 
   /*--------------------------------------------------------------------------*/
   /* The character string of the input is analyzed.                           */
@@ -670,7 +671,9 @@ s_chtml30_start_meta_tag(void *pdoc, Node *node)
         if (content_type_flag) {
           W_L(" ");
           W_V(name);
-          W_L("=\"text/html; charset=Windows-31J\"");
+          W_L("=\"");
+          W_V(chxj_header_inf_set_content_type(r, "text/html; charset=SHIFT_JIS"));
+          W_L("\"");
         }
         else
         if (refresh_flag) {
index 5bf7fd7..7441cc1 100644 (file)
@@ -22,6 +22,7 @@
 #include "chxj_img_conv.h"
 #include "chxj_qr_code.h"
 #include "chxj_encoding.h"
+#include "chxj_header_inf.h"
 
 #define GET_CHTML40(X) ((chtml40_t *)(X))
 #undef W_L
@@ -441,7 +442,7 @@ chxj_convert_chtml40(
   chtml40.entryp = entryp;
   chtml40.cookie = cookie;
 
-  chxj_set_content_type(r, "text/html; charset=Windows-31J");
+  chxj_set_content_type(r, chxj_header_inf_set_content_type(r, "text/html; charset=Windows-31J"));
 
   /*--------------------------------------------------------------------------*/
   /* The character string of the input is analyzed.                           */
@@ -669,7 +670,9 @@ s_chtml40_start_meta_tag(void *pdoc, Node *node)
         if (content_type_flag) {
           W_L(" ");
           W_V(name);
-          W_L("=\"text/html; charset=Windows-31J\"");
+          W_L("=\"");
+          W_V(chxj_header_inf_set_content_type(r, "text/html; charset=SHIFT_JIS"));
+          W_L("\"");
         }
         else
         if (refresh_flag) {
index 6a8cf1c..352170f 100644 (file)
@@ -22,6 +22,7 @@
 #include "chxj_img_conv.h"
 #include "chxj_qr_code.h"
 #include "chxj_encoding.h"
+#include "chxj_header_inf.h"
 
 #define GET_CHTML50(X) ((chtml50_t *)(X))
 #undef W_L
@@ -441,7 +442,7 @@ chxj_convert_chtml50(
   chtml50.entryp = entryp;
   chtml50.cookie = cookie;
 
-  chxj_set_content_type(r, "text/html; charset=Windows-31J");
+  chxj_set_content_type(r, chxj_header_inf_set_content_type(r, "text/html; charset=Windows-31J"));
 
   /*--------------------------------------------------------------------------*/
   /* The character string of the input is analyzed.                           */
@@ -670,7 +671,9 @@ s_chtml50_start_meta_tag(void *pdoc, Node *node)
         if (content_type_flag) {
           W_L(" ");
           W_V(name);
-          W_L("=\"text/html; charset=Windows-31J\"");
+          W_L("=\"");
+          W_V(chxj_header_inf_set_content_type(r, "text/html; charset=SHIFT_JIS"));
+          W_L("\"");
         }
         else
         if (refresh_flag) {
diff --git a/src/chxj_header_inf.c b/src/chxj_header_inf.c
new file mode 100644 (file)
index 0000000..2198c89
--- /dev/null
@@ -0,0 +1,51 @@
+/*
+ * 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 "mod_chxj.h"
+#include "chxj_header_inf.h"
+#include "chxj_apache.h"
+#include "qs_parse_string.h"
+#include <errno.h>
+
+/**
+ */
+char *
+chxj_header_inf_set_content_type(request_rec *r, char *default_string)
+{
+  char *h_out     = NULL;
+  char *err_h_out = NULL;
+
+  DBG(r,"REQ[%X] start chxj_header_inf_set_content_type()", (unsigned int)(apr_size_t)r);
+
+  h_out     = (char *)apr_table_get(r->headers_out, HTTP_X_CHXJ_SET_CONTENT_TYPE);
+  err_h_out = (char *)apr_table_get(r->err_headers_out, HTTP_X_CHXJ_SET_CONTENT_TYPE);
+
+  if (err_h_out) {
+    DBG(r,"REQ[%X] end chxj_header_inf_set_content_type()", (unsigned int)(apr_size_t)r);
+    return err_h_out;
+  }
+  if (h_out) {
+    DBG(r,"REQ[%X] end chxj_header_inf_set_content_type()", (unsigned int)(apr_size_t)r);
+    return h_out;
+  }
+
+  DBG(r,"REQ[%X] end chxj_header_inf_set_content_type()", (unsigned int)(apr_size_t)r);
+  return default_string;
+}
+
+/*
+ * vim: ts=2 et
+ */
index 8c4e884..3cbfe25 100644 (file)
@@ -22,6 +22,7 @@
 #include "chxj_encoding.h"
 #include "chxj_url_encode.h"
 #include "chxj_str_util.h"
+#include "chxj_header_inf.h"
 
 
 #define GET_JHTML(X) ((jhtml_t *)(X))
@@ -447,7 +448,7 @@ chxj_convert_jhtml(
   jhtml.entryp = entryp;
   jhtml.cookie = cookie;
 
-  chxj_set_content_type(r, "text/html; charset=Windows-31J");
+  chxj_set_content_type(r, chxj_header_inf_set_content_type(r, "text/html; charset=Windows-31J"));
 
   /*--------------------------------------------------------------------------*/
   /* The character string of the input is analyzed.                           */
@@ -702,7 +703,7 @@ s_jhtml_start_meta_tag(void *pdoc, Node *node)
           W_L(" ");
           W_V(name);
           W_L("=\"");
-          W_L("text/html; charset=Windows-31J");
+          W_V(chxj_header_inf_set_content_type(r, "text/html; charset=SHIFT_JIS"));
           W_L("\"");
         }
         else
index 133fc9e..c0672a5 100644 (file)
@@ -22,6 +22,7 @@
 #include "chxj_encoding.h"
 #include "chxj_url_encode.h"
 #include "chxj_str_util.h"
+#include "chxj_header_inf.h"
 
 
 #define GET_JXHTML(X) ((jxhtml_t *)(X))
@@ -446,7 +447,7 @@ chxj_convert_jxhtml(
   jxhtml.entryp = entryp;
   jxhtml.cookie = cookie;
 
-  chxj_set_content_type(r, "application/xhtml+xml; charset=Windows-31J");
+  chxj_set_content_type(r, chxj_header_inf_set_content_type(r, "application/xhtml+xml; charset=Windows-31J"));
 
   /*--------------------------------------------------------------------------*/
   /* The character string of the input is analyzed.                           */
@@ -705,7 +706,7 @@ s_jxhtml_start_meta_tag(void *pdoc, Node *node)
           W_L(" ");
           W_V(name);
           W_L("=\"");
-          W_L("application/xhtml+xml; charset=Windows-31J");
+          W_V(chxj_header_inf_set_content_type(r, "application/xhtml+xml; charset=SHIFT_JIS"));
           W_L("\"");
         }
         else
index ccd05b1..6985882 100644 (file)
@@ -23,6 +23,7 @@
 #include "chxj_qr_code.h"
 #include "chxj_buffered_write.h"
 #include "chxj_str_util.h"
+#include "chxj_header_inf.h"
 
 #define GET_XHTML(X) ((xhtml_t*)(X))
 #undef W_L
@@ -439,7 +440,7 @@ chxj_convert_xhtml_mobile_1_0(
   xhtml.entryp = entryp;
   xhtml.cookie = cookie;
 
-  chxj_set_content_type(r, "text/html; charset=Windows-31J");
+  chxj_set_content_type(r, chxj_header_inf_set_content_type(r, "text/html; charset=Windows-31J"));
 
   /*--------------------------------------------------------------------------*/
   /* The character string of the input is analyzed.                           */
@@ -731,6 +732,7 @@ s_xhtml_1_0_start_meta_tag(void *pdoc, Node *node)
   Attr          *attr;
   Doc           *doc   = xhtml->doc;
   int           content_type_flag = 0;
+  request_rec   *r = doc->r;
 
   W_L("<meta");
   /*--------------------------------------------------------------------------*/
@@ -763,7 +765,7 @@ s_xhtml_1_0_start_meta_tag(void *pdoc, Node *node)
         W_L(" ");
         W_V(name);
         W_L("=\"");
-        W_L("text/html; charset=Windows-31J");
+        W_V(chxj_header_inf_set_content_type(r, "text/html; charset=Windows-31J"));
         W_L("\"");
       }
       else {