diff options
author | Fumitoshi UKAI <ukai@debian.or.jp> | 2002-11-18 18:10:35 +0000 |
---|---|---|
committer | Fumitoshi UKAI <ukai@debian.or.jp> | 2002-11-18 18:10:35 +0000 |
commit | 4f37c0a28c70aaa2c7cf8da0a3260b7431570c75 (patch) | |
tree | 87ed9ef8df8eed37256003d150d8bd5a406861b1 | |
parent | [w3m-dev 03449] Add DOWNLOAD_LIST to doc*/README.func and scripts/w3mhelp.cgi.in (diff) | |
download | w3m-4f37c0a28c70aaa2c7cf8da0a3260b7431570c75.tar.gz w3m-4f37c0a28c70aaa2c7cf8da0a3260b7431570c75.zip |
[w3m-dev 03444] download from ftp.
* file.c (FTPhalfclose: static
(loadGeneralFile): UFclose
FTPhalfclose for SCM_FTP
UFclose before signal back
(loadImageBuffer): UFclose before signal back
(openGeneralPagerBuffer): UFclose
* ftp.c (ftp_fclose): added
(Ftpfclose): dont read response(), but ftp_fclose()
(FtpBye): ftp_fclose()
From: Hironori SAKAMOTO <hsaka@mth.biglobe.ne.jp>
Diffstat (limited to '')
-rw-r--r-- | ChangeLog | 15 | ||||
-rw-r--r-- | file.c | 21 | ||||
-rw-r--r-- | ftp.c | 43 |
3 files changed, 54 insertions, 25 deletions
@@ -1,4 +1,17 @@ 2002-11-19 Hironori SAKAMOTO <hsaka@mth.biglobe.ne.jp> + + * [w3m-dev 03444] download from ftp. + * file.c (FTPhalfclose: static + (loadGeneralFile): UFclose + FTPhalfclose for SCM_FTP + UFclose before signal back + (loadImageBuffer): UFclose before signal back + (openGeneralPagerBuffer): UFclose + * ftp.c (ftp_fclose): added + (Ftpfclose): dont read response(), but ftp_fclose() + (FtpBye): ftp_fclose() + +2002-11-19 Hironori SAKAMOTO <hsaka@mth.biglobe.ne.jp> * [w3m-dev 03449] Add DOWNLOAD_LIST to doc*/README.func and scripts/w3mhelp.cgi.in * doc-jp/README.func (DOWNLOAD_LIST): added @@ -4870,4 +4883,4 @@ a * [w3m-dev 03276] compile error on EWS4800 * release-0-2-1 * import w3m-0.2.1 -$Id: ChangeLog,v 1.533 2002/11/18 17:43:36 ukai Exp $ +$Id: ChangeLog,v 1.534 2002/11/18 18:10:35 ukai Exp $ @@ -1,4 +1,4 @@ -/* $Id: file.c,v 1.122 2002/11/15 16:47:03 ukai Exp $ */ +/* $Id: file.c,v 1.123 2002/11/18 18:11:25 ukai Exp $ */ #include "fm.h" #include <sys/types.h> #include "myctype.h" @@ -27,6 +27,7 @@ static int frame_source = 0; +static void FTPhalfclose(InputStream stream); static int _MoveFile(char *path1, char *path2); static void uncompress_stream(URLFile *uf); static FILE *lessopen_stream(char *path); @@ -1805,6 +1806,7 @@ loadGeneralFile(char *path, ParsedURL *volatile current, char *referer, if (save2tmp(f, tmpf) < 0) UFclose(&f); else { + UFclose(&f); if (fmInitialized) term_raw(); signal(SIGINT, prevtrap); @@ -1873,7 +1875,10 @@ loadGeneralFile(char *path, ParsedURL *volatile current, char *referer, else file = guess_save_name(t_buf, pu.file); doFileSave(f, file); - UFclose(&f); + if (f.scheme == SCM_FTP) + FTPhalfclose(f.stream); + else + UFclose(&f); return NO_BUFFER; } @@ -1899,10 +1904,10 @@ loadGeneralFile(char *path, ParsedURL *volatile current, char *referer, b->sourcefile = image_source; b->real_type = t; } + UFclose(&f); if (fmInitialized) term_raw(); signal(SIGINT, prevtrap); - UFclose(&f); return b; } #endif @@ -1952,7 +1957,10 @@ loadGeneralFile(char *path, ParsedURL *volatile current, char *referer, if (DecodeCTE && IStype(f.stream) != IST_ENCODED) f.stream = newEncodedStream(f.stream, f.encoding); doFileSave(f, guess_save_name(t_buf, pu.file)); - UFclose(&f); + if (f.scheme == SCM_FTP) + FTPhalfclose(f.stream); + else + UFclose(&f); } return NO_BUFFER; } @@ -6594,11 +6602,13 @@ loadImageBuffer(URLFile *uf, Buffer *newBuf) if (IStype(uf->stream) != IST_ENCODED) uf->stream = newEncodedStream(uf->stream, uf->encoding); if (save2tmp(*uf, cache->file) < 0) { + UFclose(uf); if (fmInitialized) term_raw(); signal(SIGINT, prevtrap); return NULL; } + UFclose(uf); if (fmInitialized) term_raw(); signal(SIGINT, prevtrap); @@ -6829,6 +6839,7 @@ openGeneralPagerBuffer(InputStream stream) #endif else { if (doExternal(uf, "-", t, &buf, t_buf)) { + UFclose(&uf); if (buf == NULL || buf == NO_BUFFER) return buf; } @@ -7049,8 +7060,6 @@ save2tmp(URLFile uf, char *tmpf) term_raw(); signal(SIGINT, prevtrap); fclose(ff); - if (uf.scheme == SCM_FTP) - FTPhalfclose(uf.stream); current_content_length = 0; return 0; } @@ -1,4 +1,4 @@ -/* $Id: ftp.c,v 1.13 2002/10/30 17:21:42 ukai Exp $ */ +/* $Id: ftp.c,v 1.14 2002/11/18 18:12:35 ukai Exp $ */ #include <stdio.h> #include <pwd.h> #include <Str.h> @@ -249,6 +249,27 @@ ftp_pasv(FTP ftp) return 0; } +static int +ftp_fclose(FTP ftp) +{ + int control_closed = 0; + + if (ftp->rcontrol != NULL) { + fclose(ftp->rcontrol); + ftp->rcontrol = NULL; + control_closed = 1; + } + if (ftp->wcontrol != NULL) { + fclose(ftp->wcontrol); + ftp->wcontrol = NULL; + control_closed = 1; + } + if (control_closed && ftp->data != NULL) { + fclose(ftp->data); + ftp->data = NULL; + } +} + int FtpCwd(FTP ftp, char *path) { @@ -298,7 +319,7 @@ Ftpfclose(FILE * f) fclose(f); if (f == current_ftp->data) current_ftp->data = NULL; - read_response(current_ftp); + ftp_fclose(current_ftp); return 0; } @@ -346,7 +367,7 @@ int FtpBye(FTP ftp) { Str tmp; - int ret_val, control_closed; + int ret_val; fwrite("QUIT\r\n", 6, sizeof(char), ftp->wcontrol); fflush(ftp->wcontrol); @@ -355,21 +376,7 @@ FtpBye(FTP ftp) ret_val = -1; else ret_val = 0; - control_closed = 0; - if (ftp->rcontrol != NULL) { - fclose(ftp->rcontrol); - ftp->rcontrol = NULL; - control_closed = 1; - } - if (ftp->wcontrol != NULL) { - fclose(ftp->wcontrol); - ftp->wcontrol = NULL; - control_closed = 1; - } - if (control_closed && ftp->data != NULL) { - fclose(ftp->data); - ftp->data = NULL; - } + ftp_fclose(ftp); return ret_val; } |