w3m

Unnamed repository; edit this file to name it for gitweb.
git clone https://logand.com/git/w3m.git/
Log | Files | Refs | README

commit 8ac42b29e9e309ee694a777c35e055f0f836afa4
parent e8586663d6a0fa9c1b034a367aad868d2acaac62
Author: ukai <ukai>
Date:   Fri,  8 Mar 2002 15:59:25 +0000

[w3m-dev 03093] Re: gopher broken
		(Re: Bug#137287: w3m: segfault on gopher://xxxx.xxx URI)
* file.c (loadGopherDir): fix ->ptr
	q should be url_quote()
* url.c (openURL): url_unquote() for gopher selector
From: Fumitoshi UKAI  <ukai@debian.or.jp>

Diffstat:
MChangeLog | 8++++++++
Mfile.c | 73+++++++++++++++++++++++++++++++++++++------------------------------------
Murl.c | 2+-
3 files changed, 46 insertions(+), 37 deletions(-)

diff --git a/ChangeLog b/ChangeLog @@ -1,3 +1,11 @@ +2002-03-09 Fumitoshi UKAI <ukai@debian.or.jp> + + * [w3m-dev 03093] Re: gopher broken + (Re: Bug#137287: w3m: segfault on gopher://xxxx.xxx URI) + * file.c (loadGopherDir): fix ->ptr + q should be url_quote() + * url.c (openURL): url_unquote() for gopher selector + 2002-03-09 Hironori Sakamoto <hsaka@mth.biglobe.ne.jp> * [w3m-dev 03090] Re: gopher broken diff --git a/file.c b/file.c @@ -6201,7 +6201,7 @@ loadHTMLString(Str page) * loadGopherDir: get gopher directory */ Buffer * -loadGopherDir(URLFile *uf, Buffer * volatile newBuf) +loadGopherDir(URLFile *uf, Buffer *volatile newBuf) { Str tmp, lbuf, name, file, host, port; char code; @@ -6215,10 +6215,10 @@ loadGopherDir(URLFile *uf, Buffer * volatile newBuf) tmp = Strnew_charp("<pre>\n"); if (SETJMP(AbortLoading) != 0) - goto gopher_end; + goto gopher_end; prevtrap = signal(SIGINT, KeyAbort); if (fmInitialized) - term_cbreak(); + term_cbreak(); #ifdef JP_CHARSET if (newBuf->document_code != '\0') @@ -6252,7 +6252,7 @@ loadGopherDir(URLFile *uf, Buffer * volatile newBuf) if (!*q) continue; p = q + 1; - for (q = p; *q && *q != '\t'&& *q != '\r' && *q != '\n'; q++) ; + for (q = p; *q && *q != '\t' && *q != '\r' && *q != '\n'; q++) ; port = Strnew_charp_n(p, q - p); switch (name->ptr[0]) { @@ -6278,28 +6278,29 @@ loadGopherDir(URLFile *uf, Buffer * volatile newBuf) p = "[unsupported]"; break; } - q = Strnew_m_charp("gopher://", host, ":", port, "/", file, NULL)->ptr; - Strcat_m_charp(tmp, "<a href=\"", html_quote(q), "\">", p, - html_quote(name->ptr + 1), "</a>\n", NULL); - } - - gopher_end: - if (fmInitialized) - term_raw(); - signal(SIGINT, prevtrap); - - Strcat_charp(tmp, "</pre>\n"); - - file = tmpfname(TMPF_SRC, ".html"); - src = fopen(file->ptr, "w"); - newBuf->sourcefile = file->ptr; - pushText(fileToDelete, file->ptr); - - init_stream(&f, SCM_LOCAL, newStrStream(tmp)); - loadHTMLstream(&f, newBuf, src, TRUE); - if (src) - fclose(src); - + q = Strnew_m_charp("gopher://", host->ptr, ":", port->ptr, + "/", file->ptr, NULL)->ptr; + Strcat_m_charp(tmp, "<a href=\"", url_quote(q), "\">", p, + html_quote(name->ptr + 1), "</a>\n", NULL); + } + + gopher_end: + if (fmInitialized) + term_raw(); + signal(SIGINT, prevtrap); + + Strcat_charp(tmp, "</pre>\n"); + + file = tmpfname(TMPF_SRC, ".html"); + src = fopen(file->ptr, "w"); + newBuf->sourcefile = file->ptr; + pushText(fileToDelete, file->ptr); + + init_stream(&f, SCM_LOCAL, newStrStream(tmp)); + loadHTMLstream(&f, newBuf, src, TRUE); + if (src) + fclose(src); + #ifdef JP_CHARSET newBuf->document_code = code; #endif /* JP_CHARSET */ @@ -6458,16 +6459,16 @@ loadImageBuffer(URLFile *uf, Buffer *newBuf) tmp = Sprintf("<img src=\"%s\"><br><br>", html_quote(image->url)); if (newBuf == NULL) newBuf = newBuffer(INIT_BUFFER_WIDTH); -/* - if (frame_source) { -*/ - tmpf = tmpfname(TMPF_SRC, ".html"); - src = fopen(tmpf->ptr, "w"); - newBuf->sourcefile = tmpf->ptr; - pushText(fileToDelete, tmpf->ptr); -/* - } -*/ + /* + * if (frame_source) { + */ + tmpf = tmpfname(TMPF_SRC, ".html"); + src = fopen(tmpf->ptr, "w"); + newBuf->sourcefile = tmpf->ptr; + pushText(fileToDelete, tmpf->ptr); + /* + * } + */ init_stream(&f, SCM_LOCAL, newStrStream(tmp)); loadHTMLstream(&f, newBuf, src, TRUE); if (src) diff --git a/url.c b/url.c @@ -1677,7 +1677,7 @@ openURL(char *url, ParsedURL *pu, ParsedURL *current, return uf; if (pu->file == NULL) pu->file = "1"; - tmp = Strnew_charp(pu->file); + tmp = Strnew_charp(url_unquote(pu->file)); Strcat_char(tmp, '\n'); } write(sock, tmp->ptr, tmp->length);