[w3m-dev-en 01067] decode content-encoding in all situations.

This commit is contained in:
Dai Sato
2006-05-29 12:54:26 +00:00
parent 48b920879b
commit 4b0c2cecc3
4 changed files with 28 additions and 6 deletions
+6 -1
View File
@@ -1,3 +1,8 @@
2006-05-29 Dai Sato <satodai@w3m.jp>
* [w3m-dev-en 01067] Some more patches
* file.c, html.h, url.c: decode content-encoding in all situations.
2006-05-29 Dai Sato <satodai@w3m.jp> 2006-05-29 Dai Sato <satodai@w3m.jp>
* [w3m-dev-en 01067] Some more patches * [w3m-dev-en 01067] Some more patches
@@ -8723,4 +8728,4 @@ a * [w3m-dev 03276] compile error on EWS4800
* release-0-2-1 * release-0-2-1
* import w3m-0.2.1 * import w3m-0.2.1
$Id: ChangeLog,v 1.963 2006/05/29 12:42:22 inu Exp $ $Id: ChangeLog,v 1.964 2006/05/29 12:54:26 inu Exp $
+17 -2
View File
@@ -1,4 +1,4 @@
/* $Id: file.c,v 1.242 2006/04/08 11:33:16 inu Exp $ */ /* $Id: file.c,v 1.243 2006/05/29 12:54:26 inu Exp $ */
#include "fm.h" #include "fm.h"
#include <sys/types.h> #include <sys/types.h>
#include "myctype.h" #include "myctype.h"
@@ -748,6 +748,7 @@ readHeader(URLFile *uf, Buffer *newBuf, int thru, ParsedURL *pu)
if (uf->compression != CMP_NOCOMPRESS) if (uf->compression != CMP_NOCOMPRESS)
break; break;
} }
uf->content_encoding = uf->compression;
} }
#ifdef USE_COOKIE #ifdef USE_COOKIE
else if (use_cookie && accept_cookie && else if (use_cookie && accept_cookie &&
@@ -2125,7 +2126,10 @@ loadGeneralFile(char *path, ParsedURL *volatile current, char *referer,
return NO_BUFFER; return NO_BUFFER;
} }
if (f.compression != CMP_NOCOMPRESS) { if (f.content_encoding != CMP_NOCOMPRESS) {
uncompress_stream(&f, &pu.real_file);
}
else if (f.compression != CMP_NOCOMPRESS) {
if (!(w3m_dump & DUMP_SOURCE) && if (!(w3m_dump & DUMP_SOURCE) &&
(w3m_dump & ~DUMP_FRAME || is_text_type(t) (w3m_dump & ~DUMP_FRAME || is_text_type(t)
|| searchExtViewer(t))) { || searchExtViewer(t))) {
@@ -7814,6 +7818,7 @@ doFileSave(URLFile uf, char *defstr)
char *p, *q; char *p, *q;
pid_t pid; pid_t pid;
char *lock; char *lock;
char *tmpf = NULL;
#if !(defined(HAVE_SYMLINK) && defined(HAVE_LSTAT)) #if !(defined(HAVE_SYMLINK) && defined(HAVE_LSTAT))
FILE *f; FILE *f;
#endif #endif
@@ -7854,6 +7859,11 @@ doFileSave(URLFile uf, char *defstr)
flush_tty(); flush_tty();
pid = fork(); pid = fork();
if (!pid) { if (!pid) {
if (uf.content_encoding != CMP_NOCOMPRESS) {
uncompress_stream(&uf, &tmpf);
if (tmpf)
unlink(tmpf);
}
setup_child(FALSE, 0, UFfileno(&uf)); setup_child(FALSE, 0, UFfileno(&uf));
if (!save2tmp(uf, p) && PreserveTimestamp && uf.modtime != -1) if (!save2tmp(uf, p) && PreserveTimestamp && uf.modtime != -1)
setModtime(p, uf.modtime); setModtime(p, uf.modtime);
@@ -7886,6 +7896,11 @@ doFileSave(URLFile uf, char *defstr)
printf("Can't save. Load file and %s are identical.", p); printf("Can't save. Load file and %s are identical.", p);
return -1; return -1;
} }
if (uf.content_encoding != CMP_NOCOMPRESS) {
uncompress_stream(&uf, &tmpf);
if (tmpf)
unlink(tmpf);
}
if (save2tmp(uf, p) < 0) { if (save2tmp(uf, p) < 0) {
/* FIXME: gettextize? */ /* FIXME: gettextize? */
printf("Can't save to %s\n", p); printf("Can't save to %s\n", p);
+2 -1
View File
@@ -1,4 +1,4 @@
/* $Id: html.h,v 1.25 2003/10/20 16:41:56 ukai Exp $ */ /* $Id: html.h,v 1.26 2006/05/29 12:54:26 inu Exp $ */
#ifndef _HTML_H #ifndef _HTML_H
#define _HTML_H #define _HTML_H
#ifdef USE_SSL #ifdef USE_SSL
@@ -69,6 +69,7 @@ typedef struct {
InputStream stream; InputStream stream;
char *ext; char *ext;
int compression; int compression;
int content_encoding;
char *guess_type; char *guess_type;
#ifdef USE_SSL #ifdef USE_SSL
char *ssl_certificate; char *ssl_certificate;
+3 -2
View File
@@ -1,4 +1,4 @@
/* $Id: url.c,v 1.92 2006/04/07 13:21:12 inu Exp $ */ /* $Id: url.c,v 1.93 2006/05/29 12:54:26 inu Exp $ */
#include "fm.h" #include "fm.h"
#include <sys/types.h> #include <sys/types.h>
#include <sys/socket.h> #include <sys/socket.h>
@@ -1453,7 +1453,8 @@ init_stream(URLFile *uf, int scheme, InputStream stream)
uf->scheme = scheme; uf->scheme = scheme;
uf->encoding = ENC_7BIT; uf->encoding = ENC_7BIT;
uf->is_cgi = FALSE; uf->is_cgi = FALSE;
uf->compression = 0; uf->compression = CMP_NOCOMPRESS;
uf->content_encoding = CMP_NOCOMPRESS;
uf->guess_type = NULL; uf->guess_type = NULL;
uf->ext = NULL; uf->ext = NULL;
uf->modtime = -1; uf->modtime = -1;