version 1.188, 2020/02/13 15:47:33 |
version 1.189, 2020/02/13 15:54:10 |
|
|
static char *urldecode(const char *); |
static char *urldecode(const char *); |
static char *recode_credentials(const char *_userinfo); |
static char *recode_credentials(const char *_userinfo); |
static char *ftp_readline(FILE *, size_t *); |
static char *ftp_readline(FILE *, size_t *); |
static void ftp_close(FILE **, struct tls **, volatile int *); |
static void ftp_close(FILE **, struct tls **, int *); |
static const char *sockerror(struct tls *); |
static const char *sockerror(struct tls *); |
#ifdef SMALL |
#ifdef SMALL |
#define ftp_printf(fp, ...) fprintf(fp, __VA_ARGS__) |
#define ftp_printf(fp, ...) fprintf(fp, __VA_ARGS__) |
|
|
char pbuf[NI_MAXSERV], hbuf[NI_MAXHOST], *cp, *portnum, *path, ststr[4]; |
char pbuf[NI_MAXSERV], hbuf[NI_MAXHOST], *cp, *portnum, *path, ststr[4]; |
char *hosttail, *cause = "unknown", *newline, *host, *port, *buf = NULL; |
char *hosttail, *cause = "unknown", *newline, *host, *port, *buf = NULL; |
char *epath, *redirurl, *loctail, *h, *p, gerror[200]; |
char *epath, *redirurl, *loctail, *h, *p, gerror[200]; |
int error, i, isftpurl = 0, isredirect = 0, rval = -1; |
int error, isftpurl = 0, isredirect = 0, rval = -1; |
int isunavail = 0, retryafter = -1; |
int isunavail = 0, retryafter = -1; |
struct addrinfo hints, *res0, *res; |
struct addrinfo hints, *res0, *res; |
const char * volatile savefile; |
const char *savefile; |
char * volatile proxyurl = NULL; |
char *proxyurl = NULL; |
char *credentials = NULL; |
char *credentials = NULL; |
volatile int fd = -1, out = -1; |
int fd = -1, out = -1; |
volatile sig_t oldintr, oldinti; |
volatile sig_t oldintr, oldinti; |
FILE *fin = NULL; |
FILE *fin = NULL; |
off_t hashbytes; |
off_t hashbytes; |
|
|
#endif |
#endif |
} |
} |
|
|
|
free(buf); |
|
if ((buf = malloc(buflen)) == NULL) |
|
errx(1, "Can't allocate memory for transfer buffer"); |
|
|
/* Trap signals */ |
/* Trap signals */ |
oldintr = NULL; |
oldintr = NULL; |
oldinti = NULL; |
oldinti = NULL; |
|
|
hashbytes = mark; |
hashbytes = mark; |
progressmeter(-1, path); |
progressmeter(-1, path); |
|
|
free(buf); |
|
|
|
/* Finally, suck down the file. */ |
/* Finally, suck down the file. */ |
if ((buf = malloc(buflen)) == NULL) |
|
errx(1, "Can't allocate memory for transfer buffer"); |
|
oldinti = signal(SIGINFO, psummary); |
oldinti = signal(SIGINFO, psummary); |
if (chunked) { |
if (chunked) { |
error = save_chunked(fin, tls, out, buf, buflen); |
error = save_chunked(fin, tls, out, buf, buflen); |
|
|
#endif /* !SMALL */ |
#endif /* !SMALL */ |
|
|
static void |
static void |
ftp_close(FILE **fin, struct tls **tls, volatile int *fd) |
ftp_close(FILE **fin, struct tls **tls, int *fd) |
{ |
{ |
#ifndef NOSSL |
#ifndef NOSSL |
int ret; |
int ret; |