aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--ChangeLog15
-rw-r--r--backend.c4
-rw-r--r--buffer.c6
-rw-r--r--display.c4
-rw-r--r--file.c28
-rw-r--r--main.c14
-rw-r--r--proto.h3
-rw-r--r--url.c3
8 files changed, 52 insertions, 25 deletions
diff --git a/ChangeLog b/ChangeLog
index 7391a2f..b9dc043 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,16 @@
+2010-07-18 d+w3m@vdr.jp
+
+ * [w3m-dev 04319] Re: w3m's bugs from bugs.debian.org
+ http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=242599#21
+ * file.c (is_html_type): added.
+ (examineFile, loadGeneralFile, _saveBuffer)
+ (openGeneralPagerBuffer, reloadBuffer): use is_html_type() instead
+ of strcasecmp().
+ (loadGeneralFile): set f.guess_tupe
+ * display.c (displayBuffer): use is_html_type() instead of strcasecmp().
+ * buffer.c (reshapeBuffer): use is_html_type() instead of strcasecmp().
+ * backend.c (internal_get): use is_html_type() instead of strcasecmp().
+
2010-07-18 Hironori SAKAMOTO <hsaka@mth.biglobe.ne.jp>
* [w3m-dev 04286] Re: break textform when buffer back
@@ -8951,4 +8964,4 @@ a * [w3m-dev 03276] compile error on EWS4800
* release-0-2-1
* import w3m-0.2.1
-$Id: ChangeLog,v 1.1007 2010/07/18 13:48:48 htrb Exp $
+$Id: ChangeLog,v 1.1008 2010/07/18 14:10:09 htrb Exp $
diff --git a/backend.c b/backend.c
index 101e67e..c418095 100644
--- a/backend.c
+++ b/backend.c
@@ -1,4 +1,4 @@
-/* $Id: backend.c,v 1.13 2003/09/22 21:02:16 ukai Exp $ */
+/* $Id: backend.c,v 1.14 2010/07/18 14:10:09 htrb Exp $ */
#include <stdio.h>
#include <string.h>
#include <sys/types.h>
@@ -95,7 +95,7 @@ internal_get(char *url, int flag, FormList *request)
buf = loadGeneralFile(url, NULL, NO_REFERER, 0, request);
do_download = FALSE;
if (buf != NULL && buf != NO_BUFFER) {
- if (!strcasecmp(buf->type, "text/html") && backend_halfdump_buf) {
+ if (is_html_type(buf->type) && backend_halfdump_buf) {
TextLineListItem *p;
Str first, last;
int len = 0;
diff --git a/buffer.c b/buffer.c
index f258dd6..5afc26a 100644
--- a/buffer.c
+++ b/buffer.c
@@ -1,4 +1,4 @@
-/* $Id: buffer.c,v 1.29 2003/09/26 17:59:51 ukai Exp $ */
+/* $Id: buffer.c,v 1.30 2010/07/18 14:10:09 htrb Exp $ */
#include "fm.h"
#ifdef USE_MOUSE
@@ -558,7 +558,7 @@ reshapeBuffer(Buffer *buf)
WcOption.auto_detect = WC_OPT_DETECT_OFF;
UseContentCharset = FALSE;
#endif
- if (!strcasecmp(buf->type, "text/html"))
+ if (is_html_type(buf->type))
loadHTMLBuffer(&f, buf);
else
loadBuffer(&f, buf);
@@ -590,7 +590,7 @@ reshapeBuffer(Buffer *buf)
gotoLine(buf, cur->linenumber);
}
buf->pos -= buf->currentLine->bpos;
- if (FoldLine && strcasecmp(buf->type, "text/html"))
+ if (FoldLine && !is_html_type(buf->type))
buf->currentColumn = 0;
else
buf->currentColumn = sbuf.currentColumn;
diff --git a/display.c b/display.c
index 386c42f..e00eb0c 100644
--- a/display.c
+++ b/display.c
@@ -1,4 +1,4 @@
-/* $Id: display.c,v 1.70 2007/05/29 12:07:02 inu Exp $ */
+/* $Id: display.c,v 1.71 2010/07/18 14:10:09 htrb Exp $ */
#include <signal.h>
#include "fm.h"
@@ -380,7 +380,7 @@ displayBuffer(Buffer *buf, int mode)
if (buf->height == 0)
buf->height = LASTLINE + 1;
if ((buf->width != INIT_BUFFER_WIDTH &&
- ((buf->type && !strcmp(buf->type, "text/html")) || FoldLine))
+ (is_html_type(buf->type) || FoldLine))
|| buf->need_reshape) {
buf->need_reshape = TRUE;
reshapeBuffer(buf);
diff --git a/file.c b/file.c
index 0e559c6..bbdd432 100644
--- a/file.c
+++ b/file.c
@@ -1,4 +1,4 @@
-/* $Id: file.c,v 1.254 2007/05/23 15:06:05 inu Exp $ */
+/* $Id: file.c,v 1.255 2010/07/18 14:10:09 htrb Exp $ */
#include "fm.h"
#include <sys/types.h>
#include "myctype.h"
@@ -272,6 +272,13 @@ is_plain_text_type(char *type)
(is_text_type(type) && !is_dump_text_type(type)));
}
+int
+is_html_type(char *type)
+{
+ return (type && (strcasecmp(type, "text/html") == 0 ||
+ strcasecmp(type, "application/xhtml+xml") == 0));
+}
+
static void
check_compression(char *path, URLFile *uf)
{
@@ -373,7 +380,7 @@ examineFile(char *path, URLFile *uf)
uf->guess_type = guessContentType(path);
if (uf->guess_type == NULL)
uf->guess_type = "text/plain";
- if (strcasecmp(uf->guess_type, "text/html") == 0)
+ if (is_html_type(uf->guess_type))
return;
if ((fp = lessopen_stream(path))) {
UFclose(uf);
@@ -2055,6 +2062,10 @@ loadGeneralFile(char *path, ParsedURL *volatile current, char *referer,
t = f.guess_type;
}
+ /* XXX: can we use guess_type to give the type to loadHTMLstream
+ * to support default utf8 encoding for XHTML here? */
+ f.guess_type = t;
+
page_loaded:
if (page) {
FILE *src;
@@ -2166,7 +2177,7 @@ loadGeneralFile(char *path, ParsedURL *volatile current, char *referer,
}
#endif
- if (!strcasecmp(t, "text/html"))
+ if (is_html_type(t))
proc = loadHTMLBuffer;
else if (is_plain_text_type(t))
proc = loadBuffer;
@@ -2230,7 +2241,7 @@ loadGeneralFile(char *path, ParsedURL *volatile current, char *referer,
b->real_type = real_type;
if (b->currentURL.host == NULL && b->currentURL.file == NULL)
copyParsedURL(&b->currentURL, &pu);
- if (!strcasecmp(t, "text/html"))
+ if (is_html_type(t))
b->type = "text/html";
else if (w3m_backend) {
Str s = Strnew_charp(t);
@@ -6949,6 +6960,8 @@ loadHTMLstream(URLFile *f, Buffer *newBuf, FILE * src, int internal)
}
if (content_charset && UseContentCharset)
doc_charset = content_charset;
+ else if (f->guess_type && !strcasecmp(f->guess_type, "application/xhtml+xml"))
+ doc_charset = WC_CES_UTF_8;
meta_charset = 0;
#endif
#if 0
@@ -7383,8 +7396,7 @@ _saveBuffer(Buffer *buf, Line *l, FILE * f, int cont)
wc_ces charset = DisplayCharset ? DisplayCharset : WC_CES_US_ASCII;
#endif
- if (buf->type && !strcasecmp(buf->type, "text/html"))
- is_html = TRUE;
+ is_html = is_html_type(buf->type);
pager_next:
for (; l != NULL; l = l->next) {
@@ -7541,7 +7553,7 @@ openGeneralPagerBuffer(InputStream stream)
t = DefaultType;
DefaultType = NULL;
}
- if (!strcasecmp(t, "text/html")) {
+ if (is_html_type(t)) {
buf = loadHTMLBuffer(&uf, t_buf);
buf->type = "text/html";
}
@@ -8351,7 +8363,7 @@ reloadBuffer(Buffer *buf)
buf->hmarklist->nmark = 0;
if (buf->imarklist)
buf->imarklist->nmark = 0;
- if (!strcasecmp(buf->type, "text/html"))
+ if (is_html_type(buf->type))
loadHTMLBuffer(&uf, buf);
else
loadBuffer(&uf, buf);
diff --git a/main.c b/main.c
index 361dc20..ceaff34 100644
--- a/main.c
+++ b/main.c
@@ -1,4 +1,4 @@
-/* $Id: main.c,v 1.259 2007/06/04 13:21:10 inu Exp $ */
+/* $Id: main.c,v 1.260 2010/07/18 14:10:09 htrb Exp $ */
#define MAINPROGRAM
#include "fm.h"
#include <signal.h>
@@ -4616,10 +4616,10 @@ DEFUN(vwSrc, SOURCE VIEW, "View HTML source")
buf = newBuffer(INIT_BUFFER_WIDTH);
- if (!strcasecmp(Currentbuf->type, "text/html")) {
+ if (is_html_type(Currentbuf->type)) {
buf->type = "text/plain";
if (Currentbuf->real_type &&
- !strcasecmp(Currentbuf->real_type, "text/html"))
+ is_html_type(Currentbuf->real_type))
buf->real_type = "text/plain";
else
buf->real_type = Currentbuf->real_type;
@@ -4769,8 +4769,8 @@ DEFUN(reload, RELOAD, "Reload buffer")
repBuffer(Currentbuf, buf);
if ((buf->type != NULL) && (sbuf.type != NULL) &&
((!strcasecmp(buf->type, "text/plain") &&
- !strcasecmp(sbuf.type, "text/html")) ||
- (!strcasecmp(buf->type, "text/html") &&
+ is_html_type(sbuf.type)) ||
+ (is_html_type(buf->type) &&
!strcasecmp(sbuf.type, "text/plain")))) {
vwSrc();
if (Currentbuf != buf)
@@ -5092,7 +5092,7 @@ DEFUN(dispI, DISPLAY_IMAGE, "Restart loading and drawing of images")
return;
displayImage = TRUE;
/*
- * if (!(Currentbuf->type && !strcmp(Currentbuf->type, "text/html")))
+ * if (!(Currentbuf->type && is_html_type(Currentbuf->type)))
* return;
*/
Currentbuf->image_flag = IMG_FLAG_AUTO;
@@ -5105,7 +5105,7 @@ DEFUN(stopI, STOP_IMAGE, "Stop loading and drawing of images")
if (!activeImage)
return;
/*
- * if (!(Currentbuf->type && !strcmp(Currentbuf->type, "text/html")))
+ * if (!(Currentbuf->type && is_html_type(Currentbuf->type)))
* return;
*/
Currentbuf->image_flag = IMG_FLAG_SKIP;
diff --git a/proto.h b/proto.h
index b8f4885..ce7e85c 100644
--- a/proto.h
+++ b/proto.h
@@ -1,4 +1,4 @@
-/* $Id: proto.h,v 1.101 2006/04/07 13:21:12 inu Exp $ */
+/* $Id: proto.h,v 1.102 2010/07/18 14:10:09 htrb Exp $ */
/*
* This file was automatically generated by version 1.7 of cextract.
* Manual editing not recommended.
@@ -165,6 +165,7 @@ extern ParsedURL *schemeToProxy(int scheme);
extern void examineFile(char *path, URLFile *uf);
extern char *acceptableEncoding();
extern int dir_exist(char *path);
+extern int is_html_type(char *type);
#ifdef USE_M17N
extern char **get_symbol(wc_ces charset, int *width);
extern char **set_symbol(int width);
diff --git a/url.c b/url.c
index 4faafce..e9fc59d 100644
--- a/url.c
+++ b/url.c
@@ -1,4 +1,4 @@
-/* $Id: url.c,v 1.95 2007/05/23 15:06:06 inu Exp $ */
+/* $Id: url.c,v 1.96 2010/07/18 14:10:09 htrb Exp $ */
#include "fm.h"
#ifndef __MINGW32_VERSION
#include <sys/types.h>
@@ -101,6 +101,7 @@ static struct table2 DefaultGuess[] = {
{"html", "text/html"},
{"htm", "text/html"},
{"shtml", "text/html"},
+ {"xhtml", "application/xhtml+xml"},
{"gif", "image/gif"},
{"jpeg", "image/jpeg"},
{"jpg", "image/jpeg"},