w3m

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

commit 65e44703223bfd58c0d4854da515080900ffb444
parent 2819cfca3add4b53fcaa09d87bf1933f9f27790a
Author: inu <inu>
Date:   Mon, 29 May 2006 12:54:26 +0000

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

Diffstat:
MChangeLog | 5+++++
Mfile.c | 17++++++++++++++++-
Mhtml.h | 1+
Murl.c | 3++-
4 files changed, 24 insertions(+), 2 deletions(-)

diff --git a/ChangeLog b/ChangeLog @@ -1,6 +1,11 @@ 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> + + * [w3m-dev-en 01067] Some more patches * main.c: delete calls to GC from wrap_GC_warn_proc to avoid deadlocks. 2006-05-29 Dai Sato <satodai@w3m.jp> diff --git a/file.c b/file.c @@ -748,6 +748,7 @@ readHeader(URLFile *uf, Buffer *newBuf, int thru, ParsedURL *pu) if (uf->compression != CMP_NOCOMPRESS) break; } + uf->content_encoding = uf->compression; } #ifdef USE_COOKIE else if (use_cookie && accept_cookie && @@ -2125,7 +2126,10 @@ loadGeneralFile(char *path, ParsedURL *volatile current, char *referer, 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) && (w3m_dump & ~DUMP_FRAME || is_text_type(t) || searchExtViewer(t))) { @@ -7814,6 +7818,7 @@ doFileSave(URLFile uf, char *defstr) char *p, *q; pid_t pid; char *lock; + char *tmpf = NULL; #if !(defined(HAVE_SYMLINK) && defined(HAVE_LSTAT)) FILE *f; #endif @@ -7854,6 +7859,11 @@ doFileSave(URLFile uf, char *defstr) flush_tty(); pid = fork(); if (!pid) { + if (uf.content_encoding != CMP_NOCOMPRESS) { + uncompress_stream(&uf, &tmpf); + if (tmpf) + unlink(tmpf); + } setup_child(FALSE, 0, UFfileno(&uf)); if (!save2tmp(uf, p) && PreserveTimestamp && uf.modtime != -1) setModtime(p, uf.modtime); @@ -7886,6 +7896,11 @@ doFileSave(URLFile uf, char *defstr) printf("Can't save. Load file and %s are identical.", p); return -1; } + if (uf.content_encoding != CMP_NOCOMPRESS) { + uncompress_stream(&uf, &tmpf); + if (tmpf) + unlink(tmpf); + } if (save2tmp(uf, p) < 0) { /* FIXME: gettextize? */ printf("Can't save to %s\n", p); diff --git a/html.h b/html.h @@ -69,6 +69,7 @@ typedef struct { InputStream stream; char *ext; int compression; + int content_encoding; char *guess_type; #ifdef USE_SSL char *ssl_certificate; diff --git a/url.c b/url.c @@ -1453,7 +1453,8 @@ init_stream(URLFile *uf, int scheme, InputStream stream) uf->scheme = scheme; uf->encoding = ENC_7BIT; uf->is_cgi = FALSE; - uf->compression = 0; + uf->compression = CMP_NOCOMPRESS; + uf->content_encoding = CMP_NOCOMPRESS; uf->guess_type = NULL; uf->ext = NULL; uf->modtime = -1;