/*
- * Copyright (C) 2005-2008 Atsushi Konno All rights reserved.
+ * Copyright (C) 2005-2011 Atsushi Konno All rights reserved.
* Copyright (C) 2005 QSDN,Inc. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
#include "chxj_encoding.h"
#include "chxj_buffered_write.h"
#include "chxj_str_util.h"
+#include "chxj_header_inf.h"
+#include "chxj_conv_z2h.h"
#define GET_CHTML10(X) ((chtml10_t *)(X))
#undef W_L
s_chtml10_chxjif_tag,
NULL,
},
+ /* tagCHXJRAW */
+ {
+ s_chtml10_chxjif_tag,
+ NULL,
+ },
/* tagNOBR */
{
NULL,
dst = NULL;
t = apr_time_now();
- DBG(r, "start chxj_convert_chtml10() cookie_id=[%s]", (cookie) ? cookie->cookie_id : "");
+ DBG(r, "REQ[%X] start %s() cookie_id=[%s]", TO_ADDR(r),__func__, (cookie) ? cookie->cookie_id : "");
/*--------------------------------------------------------------------------*/
/* If qrcode xml */
*dstlen = srclen;
dst = chxj_qr_code_blob_handler(r, src, (size_t*)dstlen);
if (dst) {
- DBG(r,"i found qrcode xml");
+ DBG(r, "REQ[%X] found qrcode xml", TO_ADDR(r));
+ DBG(r, "REQ[%X] end %s()",TO_ADDR(r),__func__);
return dst;
}
- DBG(r,"not found qrcode xml");
+ DBG(r,"REQ[%X] not found qrcode xml", TO_ADDR(r));
/*--------------------------------------------------------------------------*/
/* The CHTML structure is initialized. */
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. */
qs_all_free(&doc,QX_LOGMARK);
if (!dst) {
+ DBG(r, "REQ[%X] end %s()",TO_ADDR(r),__func__);
return apr_pstrdup(r->pool,ss);
}
chxj_dump_out("[dst] CHTML -> CHTML1.0", dst, *dstlen);
#endif
- DBG(r, "end chxj_convert_chtml10() cookie_id=[%s] time=[%" APR_TIME_T_FMT "]", (cookie) ? cookie->cookie_id : "", apr_time_now() - t);
+ DBG(r, "REQ[%X] cookie_id=[%s] time=[%" APR_TIME_T_FMT "]", TO_ADDR(r),(cookie) ? cookie->cookie_id : "", apr_time_now() - t);
+ DBG(r, "REQ[%X] end %s()",TO_ADDR(r),__func__);
return dst;
}
r = chtml10->doc->r;
if (!spec) {
- DBG(r,"spec is NULL");
+ DBG(r,"REQ[%X] spec is NULL", TO_ADDR(r));
}
for (ee = chtml10->conf->emoji;
ee = ee->next) {
if (!ee->imode) {
- DBG(r,"emoji->imode is NULL");
+ DBG(r,"REQ[%X] emoji->imode is NULL", TO_ADDR(r));
continue;
}
&& strlen(ee->imode->string) > 0
&& *ee->imode->string == *txt
&& strncasecmp(ee->imode->string, txt, strlen(ee->imode->string)) == 0) {
- if (!spec || !spec->emoji_type) {
- *rslt = apr_palloc(r->pool, 3);
- (*rslt)[0] = ee->imode->hex1byte & 0xff;
- (*rslt)[1] = ee->imode->hex2byte & 0xff;
- (*rslt)[2] = 0;
- return strlen(ee->imode->string);
- }
-
- return 0;
+ *rslt = apr_palloc(r->pool, 3);
+ (*rslt)[0] = ee->imode->hex1byte & 0xff;
+ (*rslt)[1] = ee->imode->hex2byte & 0xff;
+ (*rslt)[2] = 0;
+ return strlen(ee->imode->string);
}
}
return 0;
}
+char *
+chxj_chtml10_emoji_only_converter(request_rec *r, device_table *spec, const char *src, apr_size_t len)
+{
+ apr_size_t ii;
+ Doc __doc;
+ Doc *doc;
+ chtml10_t __chtml10;
+ chtml10_t *chtml10;
+ char one_byte[2];
+ char two_byte[3];
+ apr_pool_t *pool;
+
+ chtml10 = &__chtml10;
+ doc = &__doc;
+
+ DBG(r, "REQ[%X] start %s()", TO_ADDR(r),__func__);
+ memset(doc, 0, sizeof(Doc));
+ memset(chtml10, 0, sizeof(chtml10_t));
+
+ doc->r = r;
+ chtml10->doc = doc;
+ chtml10->spec = spec;
+ chtml10->out = qs_alloc_zero_byte_string(r->pool);
+ chtml10->conf = chxj_get_module_config(r->per_dir_config, &chxj_module);
+ chtml10->doc->parse_mode = PARSE_MODE_CHTML;
+
+ apr_pool_create(&pool, r->pool);
+
+ chxj_buffered_write_init(pool, &doc->buf);
+
+ for (ii=0; ii<len; ii++) {
+ char *out;
+ int rtn;
+
+ rtn = s_chtml10_search_emoji(chtml10, (char *)&src[ii], &out);
+ if (rtn) {
+ W_V(out);
+ ii+=(rtn - 1);
+ continue;
+ }
+
+ if (is_sjis_kanji(src[ii])) {
+ two_byte[0] = src[ii+0];
+ two_byte[1] = src[ii+1];
+ two_byte[2] = 0;
+ W_V(two_byte);
+ ii++;
+ }
+ else {
+ one_byte[0] = src[ii+0];
+ one_byte[1] = 0;
+ W_V(one_byte);
+ }
+ }
+
+ chtml10->out = chxj_buffered_write_flush(chtml10->out, &doc->buf);
+
+ DBG(r, "REQ[%X] end %s()", TO_ADDR(r),__func__);
+ return chtml10->out;
+}
+
/**
* It is a handler who processes the HTML tag.
/* CHTML1.0 */
/*--------------------------------------------------------------------*/
value = chxj_encoding_parameter(r, value);
- if (! chxj_starts_with(value, "mailto:") && ! chxj_starts_with(value, "telto:")) {
+ if (! chxj_starts_with(value, "mailto:") && ! chxj_starts_with(value, "tel:")) {
value = chxj_add_cookie_parameter(r, value, chtml10->cookie);
}
W_L(" href=\"");
W_L("<form");
if (attr_value) {
char *q;
+ char *new_query_string = NULL;
q = strchr(attr_value, '?');
if (q) {
- new_hidden_tag = chxj_form_action_to_hidden_tag(r, doc->pool, attr_value, 0, post_flag);
- if (new_hidden_tag) {
+ new_hidden_tag = chxj_form_action_to_hidden_tag(r, doc->pool, attr_value, 0, post_flag, &new_query_string, CHXJ_TRUE, CHXJ_FALSE, chtml10->entryp);
+ if (new_hidden_tag || new_query_string) {
*q = 0;
}
}
W_L(" action=\"");
W_V(attr_value);
+ if (new_query_string) {
+ W_L("?");
+ W_V(new_query_string);
+ }
W_L("\"");
}
if (attr_method) {
}
if (value && *value != 0) {
+ if (type && (STRCASEEQ('s','S',"submit",type) || STRCASEEQ('r','R',"reset",type))) {
+ apr_size_t value_len = strlen(value);
+ value = chxj_conv_z2h(r, value, &value_len, chtml10->entryp);
+ }
+
W_L(" value=\"");
W_V(chxj_add_slash_to_doublequote(doc->pool, value));
W_L("\"");
#ifdef IMG_NOT_CONVERT_FILENAME
value = chxj_encoding_parameter(r, value);
value = chxj_add_cookie_parameter(r, value, chtml10->cookie);
- if (value) {
- value = apr_psprintf(doc->buf.pool,
- "%s%c%s=true",
- value,
- (strchr(value, '?')) ? '&' : '?',
- CHXJ_COOKIE_NOUPDATE_PARAM);
- }
+ value = chxj_add_cookie_no_update_parameter(r, value);
W_L(" src=\"");
W_V(value);
W_L("\"");
value = chxj_img_conv(r, spec, value);
value = chxj_encoding_parameter(r, value);
value = chxj_add_cookie_parameter(r, value, chtml10->cookie);
- if (value) {
- value = apr_psprintf(doc->buf.pool,
- "%s%c%s=true",
- value,
- (strchr(value, '?')) ? '&' : '?',
- CHXJ_COOKIE_NOUPDATE_PARAM);
- }
+ value = chxj_add_cookie_no_update_parameter(r, value);
W_L(" src=\"");
W_V(value);
W_L("\"");
}
}
- if (value && *value != 0) {
+ if (value) {
W_L(" value=\"");
W_V(value);
W_L("\"");
chtml10_t *chtml10;
Doc *doc;
request_rec *r;
+ apr_size_t z2h_input_len;
chtml10 = GET_CHTML10(pdoc);
doc = chtml10->doc;
}
}
+ z2h_input_len = strlen(tdst);
+ tdst = chxj_conv_z2h(r, tdst, &z2h_input_len, chtml10->entryp);
+
W_V(tdst);
return chtml10->out;
}