diff options
| -rw-r--r-- | ChangeLog | 10 | ||||
| -rw-r--r-- | file.c | 69 | ||||
| -rw-r--r-- | frame.c | 24 | ||||
| -rw-r--r-- | proto.h | 3 | 
4 files changed, 74 insertions, 32 deletions
| @@ -1,3 +1,11 @@ +2002-11-27  Hiroyuki Ito <hito@crl.go.jp> + +	* [w3m-dev 03488] meta refresh in frame +	* file.c (getMetaRefreshParam): added +		(HTMLtagproc1): use getMetaRefreshParam() +	* frame.c (createFrameFile): check meta refresh +	* proto.h (getMetaRefreshProgram): added +  2002-11-27  Hironori SAKAMOTO <hsaka@mth.biglobe.ne.jp>  	* w3m 0.3.2.1 security fix @@ -5166,4 +5174,4 @@ a	* [w3m-dev 03276] compile error on EWS4800  	* release-0-2-1  	* import w3m-0.2.1 -$Id: ChangeLog,v 1.560 2002/11/26 16:58:48 ukai Exp $ +$Id: ChangeLog,v 1.561 2002/11/26 17:05:22 ukai Exp $ @@ -1,4 +1,4 @@ -/* $Id: file.c,v 1.129 2002/11/25 16:59:07 ukai Exp $ */ +/* $Id: file.c,v 1.130 2002/11/26 17:05:24 ukai Exp $ */  #include "fm.h"  #include <sys/types.h>  #include "myctype.h" @@ -3940,6 +3940,46 @@ ul_type(struct parsed_tag *tag, int default_type)  }  int +getMetaRefreshParam(char *q, Str *refresh_uri) +{ +    int refresh_interval; +    char *r; +    Str s_tmp = NULL; + +    if(q == NULL || refresh_uri == NULL) +	return 0; + +    refresh_interval = atoi(q); + +    while (*q) { +	if (!strncasecmp(q, "url=", 4)) { +	    q += 4; +	    if (*q == '\"')	/* " */ +		q++; +	    r = q; +	    while (*r && !IS_SPACE(*r) && *r != ';') +		r++; +	    s_tmp = Strnew_charp_n(q, r - q); +	     +	    if (s_tmp->ptr[s_tmp->length - 1] == '\"') {	/* "  +								 */ +		s_tmp->length--; +			s_tmp->ptr[s_tmp->length] = '\0'; +	    } +	    q = r; +	} +	while (*q && *q != ';') +	    q++; +	if (*q == ';') +	    q++; +	while (*q && *q == ' ') +	    q++; +    } +    *refresh_uri = s_tmp; +    return refresh_interval; +} + +int  HTMLtagproc1(struct parsed_tag *tag, struct html_feed_environ *h_env)  {      char *p, *q, *r; @@ -4576,33 +4616,8 @@ HTMLtagproc1(struct parsed_tag *tag, struct html_feed_environ *h_env)  	else  #endif  	if (p && q && !strcasecmp(p, "refresh")) { -	    int refresh_interval = atoi(q);  	    Str s_tmp = NULL; - -	    while (*q) { -		if (!strncasecmp(q, "url=", 4)) { -		    q += 4; -		    if (*q == '\"')	/* " */ -			q++; -		    r = q; -		    while (*r && !IS_SPACE(*r) && *r != ';') -			r++; -		    s_tmp = Strnew_charp_n(q, r - q); - -		    if (s_tmp->ptr[s_tmp->length - 1] == '\"') {	/* "  -									 */ -			s_tmp->length--; -			s_tmp->ptr[s_tmp->length] = '\0'; -		    } -		    q = r; -		} -		while (*q && *q != ';') -		    q++; -		if (*q == ';') -		    q++; -		while (*q && *q == ' ') -		    q++; -	    } +	    int refresh_interval = getMetaRefreshParam(q, &s_tmp);  	    if (s_tmp) {  		q = html_quote(s_tmp->ptr);  		tmp = @@ -1,4 +1,4 @@ -/* $Id: frame.c,v 1.18 2002/11/26 16:58:49 ukai Exp $ */ +/* $Id: frame.c,v 1.19 2002/11/26 17:05:24 ukai Exp $ */  #include "fm.h"  #include "parsetagx.h"  #include "myctype.h" @@ -599,6 +599,7 @@ createFrameFile(struct frameset *f, FILE * f1, Buffer *current, int level,  			    fputs("-->", f1);  			    goto token_end;  			case HTML_BASE: +			    /* "BASE" is prohibit tag */  			    if (parsedtag_get_value(tag, ATTR_HREF, &q)) {  				q = url_quote_conv(q, code);  				parseURL(q, &base, NULL); @@ -611,12 +612,29 @@ createFrameFile(struct frameset *f, FILE * f1, Buffer *current, int level,  				else  				    d_target = url_quote_conv(q, code);  			    } -			    /* fall thru, "BASE" is prohibit tag */ +			    Strshrinkfirst(tok, 1); +			    Strshrink(tok, 1); +			    fprintf(f1, "<!-- %s -->", tok->ptr); +			    goto token_end; +			case HTML_META: +			    parsedtag_get_value(tag, ATTR_HTTP_EQUIV, &q); +			    if (q && !strcasecmp(q, "refresh")) { +				parsedtag_get_value(tag, ATTR_CONTENT, &q); +				if (q) { +				    Str s_tmp; +				    int refresh_interval = getMetaRefreshParam(q, &s_tmp); +				    if (s_tmp) { +				        q = html_quote(s_tmp->ptr); +				        fprintf(f1, "Refresh (%d sec) <a href=\"%s\">%s</a>\n", +						refresh_interval, q, q); +				    } +				} +			    } +			    /* fall thru, "META" is prohibit tag */  			case HTML_HEAD:  			case HTML_N_HEAD:  			case HTML_BODY:  			case HTML_N_BODY: -			case HTML_META:  			case HTML_DOCTYPE:  			    /* prohibit_tags */  			    Strshrinkfirst(tok, 1); @@ -1,4 +1,4 @@ -/* $Id: proto.h,v 1.62 2002/11/25 16:57:17 ukai Exp $ */ +/* $Id: proto.h,v 1.63 2002/11/26 17:05:25 ukai Exp $ */  /*    *   This file was automatically generated by version 1.7 of cextract.   *   Manual editing not recommended. @@ -181,6 +181,7 @@ extern Str process_n_textarea(void);  extern void feed_textarea(char *str);  extern Str process_form(struct parsed_tag *tag);  extern Str process_n_form(void); +extern int getMetaRefreshParam(char *q, Str *refresh_uri);  extern int HTMLtagproc1(struct parsed_tag *tag,  			struct html_feed_environ *h_env);  extern void HTMLlineproc2(Buffer *buf, TextLineList *tl); | 
