From b9843caa2468cb8c676245cca31e4beb3a1c6906 Mon Sep 17 00:00:00 2001 From: konn Date: Tue, 18 Mar 2008 06:58:34 +0000 Subject: [PATCH] * Added features. - the reservation Query name of softbank can be used. git-svn-id: svn+ssh://svn.sourceforge.jp/svnroot/modchxj/mod_chxj/trunk@1890 1a406e8e-add9-4483-a2c8-d8cac5b7c224 --- include/chxj_jreserved_tag.h | 24 +++++++ sample_site/sf/1.php | 57 ++++++++++++++++ src/Makefile.am | 3 +- src/Makefile.in | 14 +++- src/chxj_jhtml.c | 4 +- src/chxj_jreserved_tag.c | 150 +++++++++++++++++++++++++++++++++++++++++++ src/mod_chxj.c | 5 ++ 7 files changed, 252 insertions(+), 5 deletions(-) create mode 100644 include/chxj_jreserved_tag.h create mode 100644 sample_site/sf/1.php create mode 100644 src/chxj_jreserved_tag.c diff --git a/include/chxj_jreserved_tag.h b/include/chxj_jreserved_tag.h new file mode 100644 index 00000000..ffba5253 --- /dev/null +++ b/include/chxj_jreserved_tag.h @@ -0,0 +1,24 @@ +/* + * 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_JRESERVED_TAG_H__ +#define __CHXJ_JRESERVED_TAG_H__ + +#define CHXJ_SOFTBANK_RESERVED_TAG_PREFIX "_chxj_sf_" + +extern char *chxj_jreserved_to_safe_tag(request_rec *r, const char *src); +extern char *chxj_safe_to_jreserved_tag(request_rec *r, const char *src); +#endif diff --git a/sample_site/sf/1.php b/sample_site/sf/1.php new file mode 100644 index 00000000..40640d82 --- /dev/null +++ b/sample_site/sf/1.php @@ -0,0 +1,57 @@ + + + ƒ\ƒtƒgƒoƒ“ƒN‚Ì—\–ñƒNƒGƒŠ‚̃eƒXƒg + + +"; +var_dump($_POST); +echo "
"; +echo "GETDATA
"; +var_dump($_GET); +echo "
"; +?> +
+
+ + + + + + + + + + + + + + + + + + +
+
+
+ + + + + + + + + + + + + + + + + + +
+ + diff --git a/src/Makefile.am b/src/Makefile.am index 1a9fe2b0..4d317dae 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -30,7 +30,8 @@ libmod_chxj_la_SOURCES = mod_chxj.c \ chxj_url_encode.c \ chxj_cookie.c \ chxj_preg_replace.c \ - chxj_emoji.c + chxj_emoji.c \ + chxj_jreserved_tag.c libmod_chxj_la_CFLAGS = $(AM_CFLAGS) -O2 -prefer-pic @QDEFS@ @DDEFS@ -I. -I../include diff --git a/src/Makefile.in b/src/Makefile.in index bd605fcf..7a6343a6 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -74,7 +74,8 @@ am_libmod_chxj_la_OBJECTS = libmod_chxj_la-mod_chxj.lo \ libmod_chxj_la-chxj_url_encode.lo \ libmod_chxj_la-chxj_cookie.lo \ libmod_chxj_la-chxj_preg_replace.lo \ - libmod_chxj_la-chxj_emoji.lo + libmod_chxj_la-chxj_emoji.lo \ + libmod_chxj_la-chxj_jreserved_tag.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) \ @@ -248,7 +249,8 @@ libmod_chxj_la_SOURCES = mod_chxj.c \ chxj_url_encode.c \ chxj_cookie.c \ chxj_preg_replace.c \ - chxj_emoji.c + chxj_emoji.c \ + chxj_jreserved_tag.c libmod_chxj_la_CFLAGS = $(AM_CFLAGS) -O2 -prefer-pic @QDEFS@ @DDEFS@ -I. -I../include AM_CFLAGS = @CFLAGS@ -O2 -prefer-pic @QDEFS@ @DDEFS@ -I. -I../include @@ -335,6 +337,7 @@ distclean-compile: @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@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmod_chxj_la-chxj_jreserved_tag.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmod_chxj_la-chxj_load_device_data.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmod_chxj_la-chxj_load_emoji_data.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmod_chxj_la-chxj_node_convert.Plo@am__quote@ @@ -592,6 +595,13 @@ libmod_chxj_la-chxj_emoji.lo: chxj_emoji.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_emoji.lo `test -f 'chxj_emoji.c' || echo '$(srcdir)/'`chxj_emoji.c +libmod_chxj_la-chxj_jreserved_tag.lo: chxj_jreserved_tag.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_jreserved_tag.lo -MD -MP -MF $(DEPDIR)/libmod_chxj_la-chxj_jreserved_tag.Tpo -c -o libmod_chxj_la-chxj_jreserved_tag.lo `test -f 'chxj_jreserved_tag.c' || echo '$(srcdir)/'`chxj_jreserved_tag.c +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/libmod_chxj_la-chxj_jreserved_tag.Tpo $(DEPDIR)/libmod_chxj_la-chxj_jreserved_tag.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='chxj_jreserved_tag.c' object='libmod_chxj_la-chxj_jreserved_tag.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_jreserved_tag.lo `test -f 'chxj_jreserved_tag.c' || echo '$(srcdir)/'`chxj_jreserved_tag.c + mostlyclean-libtool: -rm -f *.lo diff --git a/src/chxj_jhtml.c b/src/chxj_jhtml.c index eb2d043e..9b5bce0a 100644 --- a/src/chxj_jhtml.c +++ b/src/chxj_jhtml.c @@ -1464,7 +1464,7 @@ s_jhtml_start_input_tag(void *pdoc, Node *node) jhtml->out = apr_pstrcat(r->pool, jhtml->out, " name=\"", - name, + chxj_jreserved_to_safe_tag(r, name), "\" ", NULL); } @@ -2378,7 +2378,7 @@ s_jhtml_start_textarea_tag(void *pdoc, Node *node) value = qs_get_attr_value(doc,attr); if ((*name == 'n' || *name == 'N') && strcasecmp(name, "name") == 0) { - jhtml->out = apr_pstrcat(r->pool, jhtml->out, " name=\"",value,"\"", NULL); + jhtml->out = apr_pstrcat(r->pool, jhtml->out, " name=\"",chxj_jreserved_to_safe_tag(r, value),"\"", NULL); } else if ((*name == 'r' || *name == 'R') && strcasecmp(name, "rows") == 0) { diff --git a/src/chxj_jreserved_tag.c b/src/chxj_jreserved_tag.c new file mode 100644 index 00000000..9abbef54 --- /dev/null +++ b/src/chxj_jreserved_tag.c @@ -0,0 +1,150 @@ +/* + * 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_jreserved_tag.h" + +typedef struct r_table { + char lower; + char upper; + char *name; +} r_table_t; + +static r_table_t reserved_start_with_table[] = { + { + .lower = 'j', + .upper = 'J', + .name = "jsky", + }, +}; + + +#define RESERVED_NELT (16) +#define RESERVED_NELT_START_WITH (1) + +static r_table_t reserved_table[] = { + { + .lower = 'p', + .upper = 'P', + .name = "pid", + }, + { + .lower = 's', + .upper = 'S', + .name = "sid", + }, + { + .lower = 'u', + .upper = 'U', + .name = "uid", + }, + { + .lower = 'l', + .upper = 'L', + .name = "lid", + }, + { + .lower = 'g', + .upper = 'G', + .name = "gid", + }, + { + .lower = 'r', + .upper = 'R', + .name = "rpid", + }, + { + .lower = 'r', + .upper = 'R', + .name = "rsid", + }, + { + .lower = 'n', + .upper = 'N', + .name = "nl", + }, + { + .lower = 'c', + .upper = 'C', + .name = "cl", + }, + { + .lower = 'o', + .upper = 'O', + .name = "ol", + }, + { + .lower = 'p', + .upper = 'P', + .name = "pl", + }, + { + .lower = 'p', + .upper = 'P', + .name = "prc", + }, + { + .lower = 'c', + .upper = 'C', + .name = "cnt", + }, + { + .lower = 'r', + .upper = 'R', + .name = "reg", + }, + { + .lower = 'v', + .upper = 'V', + .name = "vsekey", + }, + { + .lower = 'v', + .upper = 'V', + .name = "vsernk", + }, +}; + + +char * +chxj_jreserved_to_safe_tag(request_rec *r, const char *src) +{ + int ii; + for (ii=0;iipool, "%s%s", CHXJ_SOFTBANK_RESERVED_TAG_PREFIX, reserved_table[ii].name); + } + } + for (ii=0; iipool, "%s%s", CHXJ_SOFTBANK_RESERVED_TAG_PREFIX, src); + } + } + return (char *)src; +} + + +char * +chxj_safe_to_jreserved_tag(request_rec *r, const char *src) +{ + if (strncasecmp(CHXJ_SOFTBANK_RESERVED_TAG_PREFIX, src, sizeof(CHXJ_SOFTBANK_RESERVED_TAG_PREFIX)-1) == 0) { + return apr_pstrdup(r->pool, &src[sizeof(CHXJ_SOFTBANK_RESERVED_TAG_PREFIX)-1]); + } + return (char *)src; +} diff --git a/src/mod_chxj.c b/src/mod_chxj.c index e9af58fd..826d4f86 100644 --- a/src/mod_chxj.c +++ b/src/mod_chxj.c @@ -60,6 +60,7 @@ #include "chxj_url_encode.h" #include "chxj_str_util.h" #include "chxj_emoji.h" +#include "chxj_jreserved_tag.h" #define CHXJ_VERSION_PREFIX PACKAGE_NAME "/" @@ -474,6 +475,8 @@ chxj_convert_input_header(request_rec *r,chxjconvrule_entry *entryp, device_tabl name = apr_strtok(pair, "=", &vstate); value = apr_strtok(NULL, "=", &vstate); + name = chxj_safe_to_jreserved_tag(r, name); + if (strncasecmp(name, "_chxj", 5) != 0) { if (strlen(result) != 0) result = apr_pstrcat(r->pool, result, "&", NULL); @@ -624,6 +627,8 @@ chxj_input_convert( name = apr_strtok(pair, "=", &vstate); value = apr_strtok(NULL, "=", &vstate); + name = chxj_safe_to_jreserved_tag(r, name); + if (strncasecmp(name, "_chxj", 5) != 0) { result = chxj_convert_emoji_param_list(r, spec, entryp, result, name, value, func_emoji_to_meta_emoji); DBG(r, "result:[%s]", result); -- 2.11.0