aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFumitoshi UKAI <ukai@debian.or.jp>2003-01-29 17:33:28 +0000
committerFumitoshi UKAI <ukai@debian.or.jp>2003-01-29 17:33:28 +0000
commit901902c777cb034865c0775f1a46f668b2619b33 (patch)
tree9391ea9621d817165b92ef0fa9a15bb592d3bfc7
parentwait_st is not used (diff)
downloadw3m-901902c777cb034865c0775f1a46f668b2619b33.tar.gz
w3m-901902c777cb034865c0775f1a46f668b2619b33.zip
[w3m-dev-en 00852] Re: Enhancement: content type detection of files
* url.c (DefaultGuess): remove upppercases (guessContentTypeFromTable): rewrite, strcasecmp From: Hironori SAKAMOTO <hsaka@mth.biglobe.ne.jp>
-rw-r--r--ChangeLog8
-rw-r--r--url.c24
2 files changed, 16 insertions, 16 deletions
diff --git a/ChangeLog b/ChangeLog
index 1f89fb6..d22db29 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
2003-01-30 Hironori SAKAMOTO <hsaka@mth.biglobe.ne.jp>
+ * [w3m-dev-en 00852] Re: Enhancement: content type detection of files
+ * url.c (DefaultGuess): remove upppercases
+ (guessContentTypeFromTable): rewrite, strcasecmp
+
+2003-01-30 Hironori SAKAMOTO <hsaka@mth.biglobe.ne.jp>
+
* [w3m-dev 03708] Re: Don't stop loading image when moving to next page.
* config.h.dist (lstat): define ifndef HAVE_LSTAT
* configure (config.h) ditto
@@ -6931,4 +6937,4 @@ a * [w3m-dev 03276] compile error on EWS4800
* release-0-2-1
* import w3m-0.2.1
-$Id: ChangeLog,v 1.723 2003/01/29 17:10:17 ukai Exp $
+$Id: ChangeLog,v 1.724 2003/01/29 17:33:28 ukai Exp $
diff --git a/url.c b/url.c
index 52030c8..60db426 100644
--- a/url.c
+++ b/url.c
@@ -1,4 +1,4 @@
-/* $Id: url.c,v 1.70 2003/01/29 17:10:53 ukai Exp $ */
+/* $Id: url.c,v 1.71 2003/01/29 17:33:28 ukai Exp $ */
#include "fm.h"
#include <sys/types.h>
#include <sys/socket.h>
@@ -86,23 +86,14 @@ struct cmdtable schemetable[] = {
static struct table2 DefaultGuess[] = {
{"html", "text/html"},
- {"HTML", "text/html"},
{"htm", "text/html"},
- {"HTM", "text/html"},
{"shtml", "text/html"},
- {"SHTML", "text/html"},
{"gif", "image/gif"},
- {"GIF", "image/gif"},
{"jpeg", "image/jpeg"},
{"jpg", "image/jpeg"},
- {"JPEG", "image/jpeg"},
- {"JPG", "image/jpeg"},
{"png", "image/png"},
- {"PNG", "image/png"},
{"xbm", "image/xbm"},
- {"XBM", "image/xbm"},
{"au", "audio/basic"},
- {"AU", "audio/basic"},
{"gz", "application/x-gzip"},
{"Z", "application/x-compress"},
{"bz2", "application/x-bzip"},
@@ -110,7 +101,6 @@ static struct table2 DefaultGuess[] = {
{"zip", "application/x-zip"},
{"lha", "application/x-lha"},
{"lzh", "application/x-lha"},
- {"LZH", "application/x-lha"},
{"ps", "application/postscript"},
{"pdf", "application/pdf"},
{NULL, NULL}
@@ -1860,6 +1850,7 @@ add_index_file(ParsedURL *pu, URLFile *uf)
static char *
guessContentTypeFromTable(struct table2 *table, char *filename)
{
+ struct table2 *t;
char *p;
if (table == NULL)
return NULL;
@@ -1869,10 +1860,13 @@ guessContentTypeFromTable(struct table2 *table, char *filename)
if (p == filename)
return NULL;
p++;
- while (table->item1) {
- if (!strcmp(p, table->item1))
- return table->item2;
- table++;
+ for (t = table; t->item1; t++) {
+ if (!strcmp(p, t->item1))
+ return t->item2;
+ }
+ for (t = table; t->item1; t++) {
+ if (!strcasecmp(p, t->item1))
+ return t->item2;
}
return NULL;
}