static int s_jhtml_search_emoji(jhtml_t *jhtml, char *txt, char **rslt);
static char *chxj_istyle_to_mode(apr_pool_t *p, const char *s);
+static css_prop_list_t *s_jhtml_push_and_get_now_style(void *pdoc, Node *node, const char *style_attr_value);
+static css_prop_list_t *s_jhtml_nopush_and_get_now_style(void *pdoc, Node *node, const char *style_attr_value);
+ static char *s_add_copyright_parameter(request_rec *r, char *value);
tag_handler jhtml_handler[] = {
for (attr = qs_get_attr(doc,node);
attr;
attr = qs_get_next_attr(doc,attr)) {
- char *name = qs_get_attr_name(doc,attr);
+ char *name = qs_get_attr_name (doc,attr);
char *value = qs_get_attr_value(doc,attr);
- if (STRCASEEQ('s','S',"src",name)) {
- /*----------------------------------------------------------------------*/
- /* CHTML 1.0 */
- /*----------------------------------------------------------------------*/
+ switch(*name) {
+ case 's':
+ case 'S':
+ if (strcasecmp(name, "src") == 0) {
+ /*--------------------------------------------------------------------*/
+ /* CHTML 1.0 */
+ /*--------------------------------------------------------------------*/
#ifdef IMG_NOT_CONVERT_FILENAME
- value = chxj_encoding_parameter(r, value);
- value = chxj_jreserved_tag_to_safe_for_query_string(r, value, jhtml->entryp);
+ value = chxj_encoding_parameter(r, value, 0);
+ value = chxj_jreserved_tag_to_safe_for_query_string(r, value, jhtml->entryp, 0);
value = chxj_add_cookie_parameter(r, value, jhtml->cookie);
value = chxj_add_cookie_no_update_parameter(r, value);
- W_L(" src=\"");
- W_V(value);
- W_L("\"");
+ value = s_add_copyright_parameter(r, value);
+ attr_src = value;
#else
value = chxj_img_conv(r, spec, value);
- value = chxj_encoding_parameter(r, value);
- value = chxj_jreserved_tag_to_safe_for_query_string(r, value, jhtml->entryp);
+ value = chxj_encoding_parameter(r, value, 0);
+ value = chxj_jreserved_tag_to_safe_for_query_string(r, value, jhtml->entryp, 0);
value = chxj_add_cookie_parameter(r, value, jhtml->cookie);
value = chxj_add_cookie_no_update_parameter(r, value);
- W_L(" src=\"");
- W_V(value);
- W_L("\"");
+ value = s_add_copyright_parameter(r, value);
+ attr_src = value;
#endif
- }
- else if (STRCASEEQ('a','A',"align",name)) {
- /*----------------------------------------------------------------------*/
- /* CHTML 1.0 */
- /*----------------------------------------------------------------------*/
- if (value) {
- if (STRCASEEQ('t','T',"top", value) ||
- STRCASEEQ('m','M',"middle",value) ||
- STRCASEEQ('b','B',"bottom",value) ||
- STRCASEEQ('l','L',"left", value) ||
- STRCASEEQ('r','R',"right", value)) {
- W_L(" align=\"");
- W_V(value);
- W_L("\"");
- }
- else if (STRCASEEQ('c','C',"center",value)) {
- W_L(" align=\"");
- W_L("middle");
- W_L("\"");
+ }
+ else if (strcasecmp(name,"style") == 0 && value && *value) {
+ attr_style = value;
+ }
+ break;
+
+ case 'a':
+ case 'A':
+ if (strcasecmp(name, "align" ) == 0) {
+ /*--------------------------------------------------------------------*/
+ /* CHTML 1.0 */
+ /*--------------------------------------------------------------------*/
+ /*--------------------------------------------------------------------*/
+ /* CHTML 4.0 */
+ /*--------------------------------------------------------------------*/
+ if (value) {
+ if (STRCASEEQ('t','T',"top", value) ||
+ STRCASEEQ('m','M',"middle",value) ||
+ STRCASEEQ('b','B',"bottom",value) ||
+ STRCASEEQ('l','L',"left", value) ||
+ STRCASEEQ('r','R',"right", value)) {
+ attr_align = value;
+ }
+ else if (STRCASEEQ('c','C',"center", value)) {
+ attr_align = apr_pstrdup(doc->pool, "middle");
+ }
}
}
+ else if (strcasecmp(name, "alt" ) == 0 && value && *value) {
+ /*--------------------------------------------------------------------*/
+ /* CHTML 1.0 */
+ /*--------------------------------------------------------------------*/
+ attr_alt = value;
+ }
+ break;
+
+ case 'w':
+ case 'W':
+ if (strcasecmp(name, "width" ) == 0 && value && *value) {
+ /*--------------------------------------------------------------------*/
+ /* CHTML 1.0 */
+ /*--------------------------------------------------------------------*/
+ attr_width = value;
+ }
+ break;
+
+ case 'h':
+ case 'H':
+ if (strcasecmp(name, "height") == 0 && value && *value) {
+ /*--------------------------------------------------------------------*/
+ /* CHTML 1.0 */
+ /*--------------------------------------------------------------------*/
+ attr_height = value;
+ }
+ else
+ if (strcasecmp(name, "hspace") == 0 && value && *value) {
+ /*--------------------------------------------------------------------*/
+ /* CHTML 1.0 */
+ /*--------------------------------------------------------------------*/
+ }
+ break;
+
+ case 'v':
+ case 'V':
+ if (strcasecmp(name, "vspace") == 0 && value && *value) {
+ /*--------------------------------------------------------------------*/
+ /* CHTML 1.0 */
+ /*--------------------------------------------------------------------*/
+ }
+ break;
+
+ default:
+ break;
}
- else if (STRCASEEQ('w','W',"width",name) && value && *value) {
- /*----------------------------------------------------------------------*/
- /* CHTML 1.0 */
- /*----------------------------------------------------------------------*/
- W_L(" width=\"");
- W_V(value);
- W_L("\"");
- }
- else if (STRCASEEQ('h','H',"height",name) && value && *value) {
- /*----------------------------------------------------------------------*/
- /* CHTML 1.0 */
- /*----------------------------------------------------------------------*/
- W_L(" height=\"");
- W_V(value);
- W_L("\"");
- }
- else if (STRCASEEQ('h','H',"hspace",name)) {
- /*----------------------------------------------------------------------*/
- /* CHTML 1.0 */
- /*----------------------------------------------------------------------*/
- /* ignore */
- }
- else if (STRCASEEQ('v','V',"vspace",name)) {
- /*----------------------------------------------------------------------*/
- /* CHTML 1.0 */
- /*----------------------------------------------------------------------*/
- /* ignore */
- }
- else if (STRCASEEQ('a','A',"alt",name) && value && *value) {
- /*----------------------------------------------------------------------*/
- /* CHTML 1.0 */
- /*----------------------------------------------------------------------*/
- W_L(" alt=\"");
- W_V(value);
- W_L("\"");
+ }
+
+ if (IS_CSS_ON(jhtml->entryp)) {
+ css_prop_list_t *style = s_jhtml_nopush_and_get_now_style(pdoc, node, attr_style);
+ if (style) {
+ css_property_t *height_prop = chxj_css_get_property_value(doc, style, "height");
+ css_property_t *width_prop = chxj_css_get_property_value(doc, style, "width");
+ css_property_t *valign_prop = chxj_css_get_property_value(doc, style, "vertical-align");
+ css_property_t *cur;
+ for (cur = height_prop->next; cur != height_prop; cur = cur->next) {
+ attr_height = apr_pstrdup(doc->pool, cur->value);
+ }
+ for (cur = width_prop->next; cur != width_prop; cur = cur->next) {
+ attr_width = apr_pstrdup(doc->pool, cur->value);
+ }
+ for (cur = valign_prop->next; cur != valign_prop; cur = cur->next) {
+ attr_align = apr_pstrdup(doc->pool, cur->value);
+ }
}
}
+
+ W_L("<img");
+ if (attr_src) {
+ W_L(" src=\"");
+ W_V(attr_src);
+ W_L("\"");
+ }
+ if (attr_align) {
+ W_L(" align=\"");
+ W_V(attr_align);
+ W_L("\"");
+ }
+ if (attr_alt) {
+ W_L(" alt=\"");
+ W_V(attr_alt);
+ W_L("\"");
+ }
+ if (attr_width) {
+ W_L(" width=\"");
+ W_V(attr_width);
+ W_L("\"");
+ }
+ if (attr_height) {
+ W_L(" height=\"");
+ W_V(attr_height);
+ W_L("\"");
+ }
W_L(">");
return jhtml->out;
}
return jhtml->out;
}
+
+/**
+ * It is a handler who processes the LINK tag.
+ *
+ * @param pdoc [i/o] The pointer to the CHTML structure at the output
+ * destination is specified.
+ * @param node [i] The LINK tag node is specified.
+ * @return The conversion result is returned.
+ */
+static char *
+s_jhtml_link_tag(void *pdoc, Node *node)
+{
+ jhtml_t *jhtml;
+ Doc *doc;
+ Attr *attr;
+ char *rel = NULL;
+ char *href = NULL;
+ char *type = NULL;
+
+ jhtml = GET_JHTML(pdoc);
+ doc = jhtml->doc;
+
+ if (! IS_CSS_ON(jhtml->entryp)) {
+ return jhtml->out;
+ }
+
+ for (attr = qs_get_attr(doc,node);
+ attr;
+ attr = qs_get_next_attr(doc,attr)) {
+ char *name = qs_get_attr_name(doc,attr);
+ char *value = qs_get_attr_value(doc,attr);
+ if (STRCASEEQ('r','R',"rel", name)) {
+ if (value && *value && STRCASEEQ('s','S',"stylesheet", value)) {
+ rel = value;
+ }
+ }
+ else if (STRCASEEQ('h','H',"href", name)) {
+ if (value && *value) {
+ href = value;
+ }
+ }
+ else if (STRCASEEQ('t','T',"type", name)) {
+ if (value && *value && STRCASEEQ('t','T',"text/css",value)) {
+ type = value;
+ }
+ }
+ }
+
+ if (rel && href && type) {
+ DBG(doc->r, "start load CSS. url:[%s]", href);
+ jhtml->style = chxj_css_parse_from_uri(doc->r, doc->pool, jhtml->style, href);
+ DBG(doc->r, "end load CSS. url:[%s]", href);
+ }
+
+ return jhtml->out;
+}
+
+
+static css_prop_list_t *
+s_jhtml_push_and_get_now_style(void *pdoc, Node *node, const char *style_attr_value)
+{
+ jhtml_t *jhtml = GET_JHTML(pdoc);
+ Doc *doc = jhtml->doc;
+ css_prop_list_t *last_css = NULL;
+ if (IS_CSS_ON(jhtml->entryp)) {
+ css_prop_list_t *dup_css;
+ css_selector_t *selector;
+
+ last_css = chxj_css_get_last_prop_list(jhtml->css_prop_stack);
+ dup_css = chxj_dup_css_prop_list(doc, last_css);
+ selector = chxj_css_find_selector(doc, jhtml->style, node);
+ if (selector) {
+ chxj_css_prop_list_merge_property(doc, dup_css, selector);
+ }
+ chxj_css_push_prop_list(jhtml->css_prop_stack, dup_css);
+ last_css = chxj_css_get_last_prop_list(jhtml->css_prop_stack);
+
+ if (style_attr_value) {
+ css_stylesheet_t *ssheet = chxj_css_parse_style_attr(doc, NULL, apr_pstrdup(doc->pool, node->name), NULL, NULL, apr_pstrdup(doc->pool, style_attr_value));
+ if (ssheet) {
+ chxj_css_prop_list_merge_property(doc, last_css, ssheet->selector_head.next);
+ }
+ }
+ }
+ return last_css;
+}
+
+
+static css_prop_list_t *
+s_jhtml_nopush_and_get_now_style(void *pdoc, Node *node, const char *style_attr_value)
+{
+ jhtml_t *jhtml = GET_JHTML(pdoc);
+ Doc *doc = jhtml->doc;
+ css_prop_list_t *last_css = NULL;
+ if (IS_CSS_ON(jhtml->entryp)) {
+ css_prop_list_t *dup_css;
+ css_selector_t *selector;
+
+ last_css = chxj_css_get_last_prop_list(jhtml->css_prop_stack);
+ dup_css = chxj_dup_css_prop_list(doc, last_css);
+ selector = chxj_css_find_selector(doc, jhtml->style, node);
+ if (selector) {
+ chxj_css_prop_list_merge_property(doc, dup_css, selector);
+ }
+ last_css = dup_css;
+
+ if (style_attr_value) {
+ css_stylesheet_t *ssheet = chxj_css_parse_style_attr(doc, NULL, apr_pstrdup(doc->pool, node->name), NULL, NULL, apr_pstrdup(doc->pool, style_attr_value));
+ if (ssheet) {
+ chxj_css_prop_list_merge_property(doc, last_css, ssheet->selector_head.next);
+ }
+ }
+ }
+ return last_css;
+}
+
+
+/**
+ * It is a handler who processes the SPAN tag.
+ *
+ * @param pdoc [i/o] The pointer to the JHTML structure at the output
+ * destination is specified.
+ * @param node [i] The SPAN tag node is specified.
+ * @return The conversion result is returned.
+ */
+static char *
+s_jhtml_start_span_tag(void *pdoc, Node *node)
+{
+ jhtml_t *jhtml;
+ Doc *doc;
+ Attr *attr;
+ char *attr_style = NULL;
+ char *attr_color = NULL;
+ char *attr_size = NULL;
+ char *attr_align = NULL;
+ char *attr_blink = NULL;
+ char *attr_marquee = NULL;
+ char *attr_marquee_dir = NULL;
+ char *attr_marquee_style = NULL;
+ char *attr_marquee_loop = NULL;
+
+ jhtml = GET_JHTML(pdoc);
+ doc = jhtml->doc;
+
+ for (attr = qs_get_attr(doc,node);
+ attr;
+ attr = qs_get_next_attr(doc,attr)) {
+ char *nm = qs_get_attr_name(doc,attr);
+ char *val = qs_get_attr_value(doc,attr);
+ if (val && STRCASEEQ('s','S',"style", nm)) {
+ attr_style = val;
+ }
+ }
+ if (IS_CSS_ON(jhtml->entryp)) {
+ css_prop_list_t *style = s_jhtml_push_and_get_now_style(pdoc, node, attr_style);
+ if (style) {
+ css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
+ css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
+ css_property_t *text_align_prop = chxj_css_get_property_value(doc, style, "text-align");
+ css_property_t *decoration_prop = chxj_css_get_property_value(doc, style, "text-decoration");
+ css_property_t *display_prop = chxj_css_get_property_value(doc, style, "display");
+ css_property_t *marquee_dir_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-dir");
+ css_property_t *marquee_style_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-style");
+ css_property_t *marquee_loop_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-loop");
+ css_property_t *cur;
+ for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
+ attr_color = apr_pstrdup(doc->pool, cur->value);
+ }
+ for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
+ if (cur->value && *cur->value) {
+ if (STRCASEEQ('x','X',"xx-small",cur->value)) {
+ attr_size = apr_pstrdup(doc->pool, "1");
+ }
+ else if (STRCASEEQ('x','X',"x-small",cur->value)) {
+ attr_size = apr_pstrdup(doc->pool, "2");
+ }
+ else if (STRCASEEQ('s','S',"small",cur->value)) {
+ attr_size = apr_pstrdup(doc->pool, "3");
+ }
+ else if (STRCASEEQ('m','M',"medium",cur->value)) {
+ attr_size = apr_pstrdup(doc->pool, "4");
+ }
+ else if (STRCASEEQ('l','L',"large",cur->value)) {
+ attr_size = apr_pstrdup(doc->pool, "5");
+ }
+ else if (STRCASEEQ('x','X',"x-large",cur->value)) {
+ attr_size = apr_pstrdup(doc->pool, "6");
+ }
+ else if (STRCASEEQ('x','X',"xx-large",cur->value)) {
+ attr_size = apr_pstrdup(doc->pool, "7");
+ }
+ }
+ }
+ for (cur = decoration_prop->next; cur != decoration_prop; cur = cur->next) {
+ if (cur->value && STRCASEEQ('b','B',"blink",cur->value)) {
+ attr_blink = apr_pstrdup(doc->pool, cur->value);
+ }
+ }
+ for (cur = display_prop->next; cur != display_prop; cur = cur->next) {
+ if (cur->value && strcasecmp("-wap-marquee",cur->value) == 0) {
+ attr_marquee = apr_pstrdup(doc->pool, cur->value);
+ }
+ }
+ for (cur = marquee_dir_prop->next; cur != marquee_dir_prop; cur = cur->next) {
+ if (cur->value && *cur->value) {
+ if (STRCASEEQ('l','L',"ltr",cur->value)) {
+ attr_marquee_dir = "right";
+ }
+ else if (STRCASEEQ('r','R',"rtl",cur->value)) {
+ attr_marquee_dir = "left";
+ }
+ }
+ }
+ for (cur = marquee_style_prop->next; cur != marquee_style_prop; cur = cur->next) {
+ if (cur->value && *cur->value) {
+ if ( STRCASEEQ('s','S',"scroll",cur->value)
+ || STRCASEEQ('s','S',"slide",cur->value)
+ || STRCASEEQ('a','A',"alternate",cur->value)) {
+ attr_marquee_style = apr_pstrdup(doc->pool, cur->value);
+ }
+ }
+ }
+ for (cur = marquee_loop_prop->next; cur != marquee_loop_prop; cur = cur->next) {
+ if (cur->value && *cur->value) {
+ if (STRCASEEQ('i','I',"infinite",cur->value)) {
+ attr_marquee_loop = "16";
+ }
+ else {
+ attr_marquee_loop = apr_pstrdup(doc->pool, cur->value);
+ }
+ }
+ }
+ for (cur = text_align_prop->next; cur != text_align_prop; cur = cur->next) {
+ if (STRCASEEQ('l','L',"left", cur->value)) {
+ attr_align = apr_pstrdup(doc->pool, "left");
+ }
+ else if (STRCASEEQ('c','C',"center",cur->value)) {
+ attr_align = apr_pstrdup(doc->pool, "center");
+ }
+ else if (STRCASEEQ('r','R',"right",cur->value)) {
+ attr_align = apr_pstrdup(doc->pool, "right");
+ }
+ }
+ }
+ }
+ if (attr_color || attr_size || attr_align || attr_blink || attr_marquee) {
+ jhtml_flags_t *flg = apr_palloc(doc->pool, sizeof(*flg));
+ memset(flg, 0, sizeof(*flg));
+ if (attr_blink) {
+ W_L("<blink>");
+ flg->with_blink_flag = 1;
+ }
+ if (attr_marquee) {
+ W_L("<marquee");
+ if (attr_marquee_dir) {
+ W_L(" direction=\"");
+ W_V(attr_marquee_dir);
+ W_L("\"");
+ }
+ if (attr_marquee_style) {
+ W_L(" behavior=\"");
+ W_V(attr_marquee_style);
+ W_L("\"");
+ }
+ if (attr_marquee_loop) {
+ W_L(" loop=\"");
+ W_V(attr_marquee_loop);
+ W_L("\"");
+ }
+ W_L(">");
+ flg->with_marquee_flag = 1;
+ }
+ if (attr_color||attr_size) {
+ W_L("<font");
+ if (attr_color) {
+ attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
+ W_L(" color=\"");
+ W_V(attr_color);
+ W_L("\"");
+ }
+ if (attr_size) {
+ W_L(" size=\"");
+ W_V(attr_size);
+ W_L("\"");
+ }
+ W_L(">");
+ flg->with_font_flag = 1;
+ }
+ if (attr_align) {
+ W_L("<div align=\"");
+ W_V(attr_align);
+ W_L("\">");
+ flg->with_div_flag = 1;
+ }
+ node->userData = flg;
+ }
+ else {
+ node->userData = NULL;
+ }
+ return jhtml->out;
+}
+
+
+/**
+ * It is a handler who processes the SPAN tag.
+ *
+ * @param pdoc [i/o] The pointer to the JHTML structure at the output
+ * destination is specified.
+ * @param node [i] The SPAN tag node is specified.
+ * @return The conversion result is returned.
+ */
+static char *
+s_jhtml_end_span_tag(void *pdoc, Node *node)
+{
+ jhtml_t *jhtml = GET_JHTML(pdoc);
+ Doc *doc = jhtml->doc;
+
+ jhtml_flags_t *flg = (jhtml_flags_t *)node->userData;
+ if (flg && flg->with_div_flag) {
+ W_L("</div>");
+ }
+ if (flg && flg->with_font_flag) {
+ W_L("</font>");
+ }
+ if (flg && flg->with_marquee_flag) {
+ W_L("</marquee>");
+ }
+ if (flg && flg->with_blink_flag) {
+ W_L("</blink>");
+ }
+ if (IS_CSS_ON(jhtml->entryp)) {
+ chxj_css_pop_prop_list(jhtml->css_prop_stack);
+ }
+ return jhtml->out;
+}
+
+
+/**
+ * It is a handler who processes the STYLE tag.
+ *
+ * @param pdoc [i/o] The pointer to the JHTML structure at the output
+ * destination is specified.
+ * @param node [i] The STYLE tag node is specified.
+ * @return The conversion result is returned.
+ */
+static char *
+s_jhtml_style_tag(void *pdoc, Node *node)
+{
+ jhtml_t *jhtml;
+ Doc *doc;
+ Attr *attr;
+ char *type = NULL;
+
+ jhtml = GET_JHTML(pdoc);
+ doc = jhtml->doc;
+
+ if (! IS_CSS_ON(jhtml->entryp)) {
+ return jhtml->out;
+ }
+
+ for (attr = qs_get_attr(doc,node);
+ attr;
+ attr = qs_get_next_attr(doc,attr)) {
+ char *name = qs_get_attr_name(doc,attr);
+ char *value = qs_get_attr_value(doc,attr);
+ if (STRCASEEQ('t','T',"type", name)) {
+ if (value && *value && STRCASEEQ('t','T',"text/css",value)) {
+ type = value;
+ }
+ }
+ }
+
+ Node *child = qs_get_child_node(doc, node);
+ if (type && child) {
+ char *name = qs_get_node_name(doc, child);
+ if (STRCASEEQ('t','T',"text", name)) {
+ char *value = qs_get_node_value(doc, child);
+ DBG(doc->r, "start load CSS. buf:[%s]", value);
+ jhtml->style = chxj_css_parse_style_value(doc, jhtml->style, value);
+ DBG(doc->r, "end load CSS. value:[%s]", value);
+ }
+ }
+ return jhtml->out;
+}
++
+ static char *
+ s_add_copyright_parameter(request_rec *r, char *value)
+ {
+ request_rec *sub_req = NULL;
+ apr_pool_t *pool;
+ int rr_status;
+ char *content_type = NULL;
+ apr_table_t *headers_out = NULL;
+
+ DBG(r, "REQ[%X] start s_add_copyright_parameter", TO_ADDR(r));
+ apr_pool_create(&pool, r->pool);
+
+ if (chxj_starts_with(value, "http:") || chxj_starts_with(value, "https:")) {
+ apr_table_t *response;
+ int response_code = 0;
+ response = chxj_serf_head(r, pool, value, &response_code);
+ if (response_code != HTTP_OK) {
+ DBG(r, "REQ[%X] end s_add_copyright_parameter (serf_req->status:[%d])", TO_ADDR(r), response_code);
+ return value;
+ }
+ content_type = (char *)apr_table_get(response, "Content-Type");
+ headers_out = response;
+ }
+ else {
+ // sub_req = ap_sub_req_method_uri("GET", value, r, r->output_filters);
+ sub_req = ap_sub_req_lookup_uri(value, r, r->output_filters);
+ if (sub_req->status != HTTP_OK) {
+ DBG(r, "REQ[%X] end s_add_copyright_parameter (sub_req->status:[%d])", TO_ADDR(r), sub_req->status);
+ ap_destroy_sub_req(sub_req);
+ return value;
+ }
+ sub_req->header_only = 1;
+ sub_req->main = NULL;
+ rr_status = ap_run_sub_req(sub_req);
+ DBG(r, "REQ[%X] sub_req4:ContentType:[%s]", TO_ADDR(r), sub_req->content_type);
+ DBG(r, "REQ[%X] rr_status:[%d]", TO_ADDR(r), rr_status);
+ content_type = apr_pstrdup(pool, sub_req->content_type);
+ headers_out = sub_req->headers_out;
+ }
+ if (headers_out && apr_table_get(headers_out, "x-jphone-copyright")) {
+ if (content_type && strncasecmp("image/jpeg", content_type, 10) == 0) {
+ if (strchr(value, '?')) {
+ value = apr_psprintf(pool, "%s&_chxj_copy=.jpz", value);
+ }
+ else {
+ value = apr_psprintf(pool, "%s?_chxj_copy=.jpz", value);
+ }
+ }
+ else if (content_type && strncasecmp("image/png", content_type, 9) == 0) {
+ if (strchr(value, '?')) {
+ value = apr_psprintf(pool, "%s&_chxj_copy=.pnz", value);
+ }
+ else {
+ value = apr_psprintf(pool, "%s?_chxj_copy=.pnz", value);
+ }
+ }
+ }
+ if (sub_req) {
+ ap_destroy_sub_req(sub_req);
+ }
+ DBG(r, "REQ[%X] end s_add_copyright_parameter(result:[%s]", TO_ADDR(r), value);
+ return value;
+ }
+
+
/*
* vim:ts=2 et
*/