[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>
This commit is contained in:
@@ -1,3 +1,16 @@
|
|||||||
|
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>
|
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
|
* [w3m-dev 03449] Add DOWNLOAD_LIST to doc*/README.func and scripts/w3mhelp.cgi.in
|
||||||
@@ -4870,4 +4883,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.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 "fm.h"
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include "myctype.h"
|
#include "myctype.h"
|
||||||
@@ -27,6 +27,7 @@
|
|||||||
|
|
||||||
static int frame_source = 0;
|
static int frame_source = 0;
|
||||||
|
|
||||||
|
static void FTPhalfclose(InputStream stream);
|
||||||
static int _MoveFile(char *path1, char *path2);
|
static int _MoveFile(char *path1, char *path2);
|
||||||
static void uncompress_stream(URLFile *uf);
|
static void uncompress_stream(URLFile *uf);
|
||||||
static FILE *lessopen_stream(char *path);
|
static FILE *lessopen_stream(char *path);
|
||||||
@@ -1805,6 +1806,7 @@ loadGeneralFile(char *path, ParsedURL *volatile current, char *referer,
|
|||||||
if (save2tmp(f, tmpf) < 0)
|
if (save2tmp(f, tmpf) < 0)
|
||||||
UFclose(&f);
|
UFclose(&f);
|
||||||
else {
|
else {
|
||||||
|
UFclose(&f);
|
||||||
if (fmInitialized)
|
if (fmInitialized)
|
||||||
term_raw();
|
term_raw();
|
||||||
signal(SIGINT, prevtrap);
|
signal(SIGINT, prevtrap);
|
||||||
@@ -1873,6 +1875,9 @@ loadGeneralFile(char *path, ParsedURL *volatile current, char *referer,
|
|||||||
else
|
else
|
||||||
file = guess_save_name(t_buf, pu.file);
|
file = guess_save_name(t_buf, pu.file);
|
||||||
doFileSave(f, file);
|
doFileSave(f, file);
|
||||||
|
if (f.scheme == SCM_FTP)
|
||||||
|
FTPhalfclose(f.stream);
|
||||||
|
else
|
||||||
UFclose(&f);
|
UFclose(&f);
|
||||||
return NO_BUFFER;
|
return NO_BUFFER;
|
||||||
}
|
}
|
||||||
@@ -1899,10 +1904,10 @@ loadGeneralFile(char *path, ParsedURL *volatile current, char *referer,
|
|||||||
b->sourcefile = image_source;
|
b->sourcefile = image_source;
|
||||||
b->real_type = t;
|
b->real_type = t;
|
||||||
}
|
}
|
||||||
|
UFclose(&f);
|
||||||
if (fmInitialized)
|
if (fmInitialized)
|
||||||
term_raw();
|
term_raw();
|
||||||
signal(SIGINT, prevtrap);
|
signal(SIGINT, prevtrap);
|
||||||
UFclose(&f);
|
|
||||||
return b;
|
return b;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@@ -1952,6 +1957,9 @@ loadGeneralFile(char *path, ParsedURL *volatile current, char *referer,
|
|||||||
if (DecodeCTE && IStype(f.stream) != IST_ENCODED)
|
if (DecodeCTE && IStype(f.stream) != IST_ENCODED)
|
||||||
f.stream = newEncodedStream(f.stream, f.encoding);
|
f.stream = newEncodedStream(f.stream, f.encoding);
|
||||||
doFileSave(f, guess_save_name(t_buf, pu.file));
|
doFileSave(f, guess_save_name(t_buf, pu.file));
|
||||||
|
if (f.scheme == SCM_FTP)
|
||||||
|
FTPhalfclose(f.stream);
|
||||||
|
else
|
||||||
UFclose(&f);
|
UFclose(&f);
|
||||||
}
|
}
|
||||||
return NO_BUFFER;
|
return NO_BUFFER;
|
||||||
@@ -6594,11 +6602,13 @@ loadImageBuffer(URLFile *uf, Buffer *newBuf)
|
|||||||
if (IStype(uf->stream) != IST_ENCODED)
|
if (IStype(uf->stream) != IST_ENCODED)
|
||||||
uf->stream = newEncodedStream(uf->stream, uf->encoding);
|
uf->stream = newEncodedStream(uf->stream, uf->encoding);
|
||||||
if (save2tmp(*uf, cache->file) < 0) {
|
if (save2tmp(*uf, cache->file) < 0) {
|
||||||
|
UFclose(uf);
|
||||||
if (fmInitialized)
|
if (fmInitialized)
|
||||||
term_raw();
|
term_raw();
|
||||||
signal(SIGINT, prevtrap);
|
signal(SIGINT, prevtrap);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
UFclose(uf);
|
||||||
if (fmInitialized)
|
if (fmInitialized)
|
||||||
term_raw();
|
term_raw();
|
||||||
signal(SIGINT, prevtrap);
|
signal(SIGINT, prevtrap);
|
||||||
@@ -6829,6 +6839,7 @@ openGeneralPagerBuffer(InputStream stream)
|
|||||||
#endif
|
#endif
|
||||||
else {
|
else {
|
||||||
if (doExternal(uf, "-", t, &buf, t_buf)) {
|
if (doExternal(uf, "-", t, &buf, t_buf)) {
|
||||||
|
UFclose(&uf);
|
||||||
if (buf == NULL || buf == NO_BUFFER)
|
if (buf == NULL || buf == NO_BUFFER)
|
||||||
return buf;
|
return buf;
|
||||||
}
|
}
|
||||||
@@ -7049,8 +7060,6 @@ save2tmp(URLFile uf, char *tmpf)
|
|||||||
term_raw();
|
term_raw();
|
||||||
signal(SIGINT, prevtrap);
|
signal(SIGINT, prevtrap);
|
||||||
fclose(ff);
|
fclose(ff);
|
||||||
if (uf.scheme == SCM_FTP)
|
|
||||||
FTPhalfclose(uf.stream);
|
|
||||||
current_content_length = 0;
|
current_content_length = 0;
|
||||||
return 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 <stdio.h>
|
||||||
#include <pwd.h>
|
#include <pwd.h>
|
||||||
#include <Str.h>
|
#include <Str.h>
|
||||||
@@ -249,6 +249,27 @@ ftp_pasv(FTP ftp)
|
|||||||
return 0;
|
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
|
int
|
||||||
FtpCwd(FTP ftp, char *path)
|
FtpCwd(FTP ftp, char *path)
|
||||||
{
|
{
|
||||||
@@ -298,7 +319,7 @@ Ftpfclose(FILE * f)
|
|||||||
fclose(f);
|
fclose(f);
|
||||||
if (f == current_ftp->data)
|
if (f == current_ftp->data)
|
||||||
current_ftp->data = NULL;
|
current_ftp->data = NULL;
|
||||||
read_response(current_ftp);
|
ftp_fclose(current_ftp);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -346,7 +367,7 @@ int
|
|||||||
FtpBye(FTP ftp)
|
FtpBye(FTP ftp)
|
||||||
{
|
{
|
||||||
Str tmp;
|
Str tmp;
|
||||||
int ret_val, control_closed;
|
int ret_val;
|
||||||
|
|
||||||
fwrite("QUIT\r\n", 6, sizeof(char), ftp->wcontrol);
|
fwrite("QUIT\r\n", 6, sizeof(char), ftp->wcontrol);
|
||||||
fflush(ftp->wcontrol);
|
fflush(ftp->wcontrol);
|
||||||
@@ -355,21 +376,7 @@ FtpBye(FTP ftp)
|
|||||||
ret_val = -1;
|
ret_val = -1;
|
||||||
else
|
else
|
||||||
ret_val = 0;
|
ret_val = 0;
|
||||||
control_closed = 0;
|
ftp_fclose(ftp);
|
||||||
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;
|
|
||||||
}
|
|
||||||
return ret_val;
|
return ret_val;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user