aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog10
-rw-r--r--file.c75
-rw-r--r--url.c4
3 files changed, 49 insertions, 40 deletions
diff --git a/ChangeLog b/ChangeLog
index 2432f19..d8c6f44 100644
--- 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
@@ -3082,4 +3090,4 @@
* release-0-2-1
* import w3m-0.2.1
-$Id: ChangeLog,v 1.337 2002/03/08 15:16:02 ukai Exp $
+$Id: ChangeLog,v 1.338 2002/03/08 15:59:25 ukai Exp $
diff --git a/file.c b/file.c
index d5a9782..1dc4419 100644
--- a/file.c
+++ b/file.c
@@ -1,4 +1,4 @@
-/* $Id: file.c,v 1.76 2002/03/08 15:16:02 ukai Exp $ */
+/* $Id: file.c,v 1.77 2002/03/08 15:59:25 ukai Exp $ */
#include "fm.h"
#include <sys/types.h>
#include "myctype.h"
@@ -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
index 2c8058e..5ef1b0c 100644
--- a/url.c
+++ b/url.c
@@ -1,4 +1,4 @@
-/* $Id: url.c,v 1.47 2002/03/06 03:32:11 ukai Exp $ */
+/* $Id: url.c,v 1.48 2002/03/08 15:59:25 ukai Exp $ */
#include "fm.h"
#include <sys/types.h>
#include <sys/socket.h>
@@ -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);