From e312638d0c8d64fe85db128d0eb8c3885a8bfe88 Mon Sep 17 00:00:00 2001 From: Fumitoshi UKAI Date: Wed, 5 Feb 2003 16:43:56 +0000 Subject: [w3m-dev 03730] display decoded URL * anchor.c (link_list_panel): support DecodeURL * display.c (make_lastline_link): support DecodeURL * etc.c (url_unquote_conv): added * fm.h (DecodeURL): added * history.c (historyBuffer): support DecodeURL * indep.c (QUOTE_MAP): added (HTML_QUOTE_MAP): added (html_quote_char): deleted (url_quote): use is_url_quote (file_quote): use is_file_quote (is_url_safe): deleted (Str_form_quote): use is_url_unsafe (Str_url_unquote): add safe args (is_shell_safe): delete (shell_quote): use is_shell_unsafe * indep.h (QUOTE_MAP): added (HTML_QUOTE_MAP): added (HTML_QUOTE_MASK): added (SHELL_UNSAFE_MASK): added (URL_QUOTE_MASK): added (FILE_QUOTE_MASK): added (URL_UNSAFE_MASK): added (GET_QUOTE_TYPE): added (is_html_quote): added (is_shell_unsafe): added (is_url_quote): added (is_file_quote): added (is_url_unsafe): added (html_quote_char): added (html_quote_char): deleted (Str_url_unquote): added safe (form_unquote): Str_url_unquote changes * linein.c (_prev): support DecodeURL (_next): ditto * main.c (goURL0): support DecodeURL (_peekURL): ditto (curURL): ditto * map.c (follow_map_panel): support DecodeURL (append_map_info): ditto (append_link_info): ditto (append_frame_info): ditto (page_info_panel): ditto * menu.c (initSelectMenu): delete SCM_LOCAL_CGI support DecodeURL (initSelTabMenu): delete SCM_LOCAL_CGI support DecodeURL (link_menu): support DecodeURL * parsetagx.c (parse_tag): is_html_quote * proto.h (url_unquote_conv): added * rc.c (CMT_DECODE_URL): added (params1): add decode_url * url.c (openURL): Str_url_unquote non safe From: Hironori SAKAMOTO --- map.c | 84 ++++++++++++++++++++++++++++++++++++++++++++++--------------------- 1 file changed, 58 insertions(+), 26 deletions(-) (limited to 'map.c') diff --git a/map.c b/map.c index 7ce2cbe..c25cc92 100644 --- a/map.c +++ b/map.c @@ -1,4 +1,4 @@ -/* $Id: map.c,v 1.26 2003/01/20 15:54:11 ukai Exp $ */ +/* $Id: map.c,v 1.27 2003/02/05 16:43:59 ukai Exp $ */ /* * client-side image maps */ @@ -263,7 +263,7 @@ follow_map_panel(Buffer *buf, char *name) ListItem *al; MapArea *a; ParsedURL pu; - char *url; + char *p, *q; ml = searchMapList(buf, name); if (ml == NULL) @@ -275,10 +275,15 @@ follow_map_panel(Buffer *buf, char *name) if (!a) continue; parseURL2(a->url, &pu, baseURL(buf)); - url = html_quote(parsedURL2Str(&pu)->ptr); - Strcat_m_charp(mappage, "", + p = parsedURL2Str(&pu)->ptr; + q = html_quote(p); + if (DecodeURL) + p = html_quote(url_unquote_conv(p, buf->document_code)); + else + p = q; + Strcat_m_charp(mappage, "", html_quote(*a->alt ? a->alt : mybasename(a->url)), - "", url, NULL); + "", p, NULL); } Strcat_charp(mappage, ""); @@ -391,7 +396,7 @@ append_map_info(Buffer *buf, Str tmp, FormItemList *fi) ListItem *al; MapArea *a; ParsedURL pu; - char *url; + char *p, *q; ml = searchMapList(buf, fi->value ? fi->value->ptr : NULL); if (ml == NULL) @@ -405,11 +410,15 @@ append_map_info(Buffer *buf, Str tmp, FormItemList *fi) if (!a) continue; parseURL2(a->url, &pu, baseURL(buf)); - url = html_quote(parsedURL2Str(&pu)->ptr); + q = html_quote(parsedURL2Str(&pu)->ptr); + if (DecodeURL) + p = html_quote(url_unquote_conv(a->url, buf->document_code)); + else + p = html_quote(a->url); Strcat_m_charp(tmp, "  ", + q, "\">", html_quote(*a->alt ? a->alt : mybasename(a->url)), - "", html_quote(a->url), "\n", NULL); + "", p, "\n", NULL); } Strcat_charp(tmp, ""); } @@ -440,8 +449,13 @@ append_link_info(Buffer *buf, Str html, LinkList * link) Strcat_charp(html, "[Rel]"); else if (l->type == LINK_TYPE_REV) Strcat_charp(html, "[Rev]"); - Strcat_m_charp(html, "", l->url ? html_quote(l->url) : "(empty)", - NULL); + if (!l->url) + url = "(empty)"; + else if (DecodeURL) + url = html_quote(url_unquote_conv(l->url, buf->document_code)); + else + url = html_quote(l->url); + Strcat_m_charp(html, "", url, NULL); if (l->ctype) Strcat_m_charp(html, " (", html_quote(l->ctype), ")", NULL); Strcat_charp(html, "\n"); @@ -473,14 +487,16 @@ append_frame_info(Buffer *buf, Str html, struct frameset *set, int level) q = html_quote(frame.body->url); Strcat_m_charp(html, "", NULL); if (frame.body->name) { - p = file_unquote(frame.body->name); -#ifdef JP_CHARSET - p = conv(p, buf->document_code, InnerCode)->ptr; -#endif - p = html_quote(p); + p = html_quote(url_unquote_conv(frame.body->name, + buf->document_code)); Strcat_charp(html, p); } - Strcat_m_charp(html, " ", q, "
\n", NULL); + if (DecodeURL) + p = html_quote(url_unquote_conv(frame.body->url, + buf->document_code)); + else + p = q; + Strcat_m_charp(html, " ", p, "
\n", NULL); #ifdef USE_SSL if (frame.body->ssl_certificate) Strcat_m_charp(html, @@ -505,11 +521,11 @@ page_info_panel(Buffer *buf) { Str tmp = Strnew_size(1024); Anchor *a; - Str s; ParsedURL pu; TextListItem *ti; struct frameset *f_set = NULL; int all; + char *p, *q; Strcat_charp(tmp, "\ Information about current page\ @@ -520,11 +536,14 @@ page_info_panel(Buffer *buf) all = buf->allLine; if (all == 0 && buf->lastLine) all = buf->lastLine->linenumber; + p = parsedURL2Str(&buf->currentURL)->ptr; + if (DecodeURL) + p = url_unquote_conv(p, 0); Strcat_m_charp(tmp, "", "
Title", html_quote(buf->buffername), "
Current URL", - html_quote(parsedURL2Str(&buf->currentURL)->ptr), + html_quote(p), "
Document Type", buf->real_type ? html_quote(buf->real_type) : "unknown", "
Last Modified", @@ -540,29 +559,42 @@ page_info_panel(Buffer *buf) a = retrieveCurrentAnchor(buf); if (a != NULL) { - char *aurl; parseURL2(a->url, &pu, baseURL(buf)); - s = parsedURL2Str(&pu); - aurl = html_quote(s->ptr); + p = parsedURL2Str(&pu)->ptr; + q = html_quote(p); + if (DecodeURL) + p = html_quote(url_unquote_conv(p, buf->document_code)); + else + p = q; Strcat_m_charp(tmp, "
URL of current anchor", aurl, "", NULL); + q, "\">", p, "", NULL); } a = retrieveCurrentImg(buf); if (a != NULL) { parseURL2(a->url, &pu, baseURL(buf)); - s = parsedURL2Str(&pu); + p = parsedURL2Str(&pu)->ptr; + q = html_quote(p); + if (DecodeURL) + p = html_quote(url_unquote_conv(p, buf->document_code)); + else + p = q; Strcat_m_charp(tmp, "
URL of current imageptr), "\">", html_quote(s->ptr), "", + q, "\">", p, "", NULL); } a = retrieveCurrentForm(buf); if (a != NULL) { FormItemList *fi = (FormItemList *)a->url; + p = form2str(fi); + if (DecodeURL) + p = html_quote(url_unquote_conv(p, buf->document_code)); + else + p = html_quote(p); Strcat_m_charp(tmp, "
Method/type of current form ", - html_quote(form2str(fi)), NULL); + p, NULL); if (fi->parent->method == FORM_METHOD_INTERNAL && !Strcmp_charp(fi->parent->action, "map")) append_map_info(buf, tmp, fi->parent->item); -- cgit v1.2.3