version 1.192, 2020/02/20 00:45:09 |
version 1.193, 2020/02/22 00:58:28 |
|
|
char *proxyhost = NULL; |
char *proxyhost = NULL; |
#ifndef NOSSL |
#ifndef NOSSL |
char *sslpath = NULL, *sslhost = NULL; |
char *sslpath = NULL, *sslhost = NULL; |
int ishttpurl = 0, ishttpsurl = 0; |
int ishttpsurl = 0; |
#endif /* !NOSSL */ |
#endif /* !NOSSL */ |
#ifndef SMALL |
#ifndef SMALL |
char *full_host = NULL; |
char *full_host = NULL; |
|
|
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 NOSSL |
|
ishttpurl = 1; |
|
#endif /* !NOSSL */ |
|
#ifndef SMALL |
#ifndef SMALL |
scheme = HTTP_URL; |
scheme = HTTP_URL; |
#endif /* !SMALL */ |
#endif /* !SMALL */ |
|
|
|
|
path = strchr(host, '/'); /* Find path */ |
path = strchr(host, '/'); /* Find path */ |
|
|
#ifndef NOSSL |
|
/* |
/* |
* Look for auth header in host. |
* Look for auth header in host. |
* Basic auth from RFC 2617, valid characters for path are in |
* Basic auth from RFC 2617, valid characters for path are in |
* RFC 3986 section 3.3. |
* RFC 3986 section 3.3. |
*/ |
*/ |
if (ishttpurl || ishttpsurl) { |
if (!isftpurl) { |
p = strchr(host, '@'); |
p = strchr(host, '@'); |
if (p != NULL && (path == NULL || p < path)) { |
if (p != NULL && (path == NULL || p < path)) { |
*p++ = '\0'; |
*p++ = '\0'; |
|
|
path = strchr(host, '/'); |
path = strchr(host, '/'); |
} |
} |
} |
} |
#endif /* !NOSSL */ |
|
|
|
if (EMPTYSTRING(path)) { |
if (EMPTYSTRING(path)) { |
if (outfile) { /* No slash, but */ |
if (outfile) { /* No slash, but */ |
|
|
restart_point = 0; |
restart_point = 0; |
} |
} |
#endif /* SMALL */ |
#endif /* SMALL */ |
#ifndef NOSSL |
|
if (credentials) { |
if (credentials) { |
ftp_printf(fin, |
ftp_printf(fin, |
"GET /%s HTTP/1.1\r\n" |
"GET /%s HTTP/1.1\r\n" |
|
|
free(credentials); |
free(credentials); |
credentials = NULL; |
credentials = NULL; |
} else |
} else |
#endif /* NOSSL */ |
|
ftp_printf(fin, |
ftp_printf(fin, |
"GET /%s HTTP/1.1\r\n" |
"GET /%s HTTP/1.1\r\n" |
"Connection: close\r\n" |
"Connection: close\r\n" |