version 1.180, 2019/12/02 22:32:18 |
version 1.181, 2019/12/05 10:26:25 |
|
|
char *proxyhost = NULL; |
char *proxyhost = NULL; |
#ifndef NOSSL |
#ifndef NOSSL |
char *sslpath = NULL, *sslhost = NULL; |
char *sslpath = NULL, *sslhost = NULL; |
char *full_host = NULL; |
|
const char *scheme; |
|
int ishttpurl = 0, ishttpsurl = 0; |
int ishttpurl = 0, ishttpsurl = 0; |
#endif /* !NOSSL */ |
#endif /* !NOSSL */ |
#ifndef SMALL |
#ifndef SMALL |
|
char *full_host = NULL; |
|
const char *scheme; |
char *locbase; |
char *locbase; |
struct addrinfo *ares = NULL; |
struct addrinfo *ares = NULL; |
#endif |
#endif /* !SMALL */ |
struct tls *tls = NULL; |
struct tls *tls = NULL; |
int status; |
int status; |
int save_errno; |
int save_errno; |
|
|
errx(1, "Can't allocate memory to parse URL"); |
errx(1, "Can't allocate memory to parse URL"); |
if (strncasecmp(newline, HTTP_URL, sizeof(HTTP_URL) - 1) == 0) { |
if (strncasecmp(newline, HTTP_URL, sizeof(HTTP_URL) - 1) == 0) { |
host = newline + sizeof(HTTP_URL) - 1; |
host = newline + sizeof(HTTP_URL) - 1; |
#ifndef SMALL |
#ifndef NOSSL |
ishttpurl = 1; |
ishttpurl = 1; |
|
#endif /* !NOSSL */ |
|
#ifndef SMALL |
scheme = HTTP_URL; |
scheme = HTTP_URL; |
#endif /* !SMALL */ |
#endif /* !SMALL */ |
} else if (strncasecmp(newline, FTP_URL, sizeof(FTP_URL) - 1) == 0) { |
} else if (strncasecmp(newline, FTP_URL, sizeof(FTP_URL) - 1) == 0) { |
|
|
} else if (strncasecmp(newline, FILE_URL, sizeof(FILE_URL) - 1) == 0) { |
} else if (strncasecmp(newline, FILE_URL, sizeof(FILE_URL) - 1) == 0) { |
host = newline + sizeof(FILE_URL) - 1; |
host = newline + sizeof(FILE_URL) - 1; |
isfileurl = 1; |
isfileurl = 1; |
#ifndef NOSSL |
#ifndef SMALL |
scheme = FILE_URL; |
scheme = FILE_URL; |
|
#endif /* !SMALL */ |
|
#ifndef NOSSL |
} else if (strncasecmp(newline, HTTPS_URL, sizeof(HTTPS_URL) - 1) == 0) { |
} else if (strncasecmp(newline, HTTPS_URL, sizeof(HTTPS_URL) - 1) == 0) { |
host = newline + sizeof(HTTPS_URL) - 1; |
host = newline + sizeof(HTTPS_URL) - 1; |
ishttpsurl = 1; |
ishttpsurl = 1; |
|
#ifndef SMALL |
scheme = HTTPS_URL; |
scheme = HTTPS_URL; |
|
#endif /* !SMALL */ |
#endif /* !NOSSL */ |
#endif /* !NOSSL */ |
} else |
} else |
errx(1, "url_get: Invalid URL '%s'", newline); |
errx(1, "url_get: Invalid URL '%s'", newline); |
|
|
warnx("Improper response from %s", host); |
warnx("Improper response from %s", host); |
|
|
cleanup_url_get: |
cleanup_url_get: |
#ifndef NOSSL |
#ifndef SMALL |
free(full_host); |
free(full_host); |
|
#endif /* !SMALL */ |
|
#ifndef NOSSL |
free(sslhost); |
free(sslhost); |
#endif /* !NOSSL */ |
#endif /* !NOSSL */ |
ftp_close(&fin, &tls, &fd); |
ftp_close(&fin, &tls, &fd); |