version 1.92, 2009/07/18 12:43:30 |
version 1.93, 2009/07/27 23:11:26 |
|
|
if (isfileurl) { |
if (isfileurl) { |
path = host; |
path = host; |
} else { |
} else { |
path = strchr(host, '/'); /* find path */ |
path = strchr(host, '/'); /* Find path */ |
if (EMPTYSTRING(path)) { |
if (EMPTYSTRING(path)) { |
|
if (outfile) { /* No slash, but */ |
|
path=strchr(host,'\0'); /* we have outfile. */ |
|
goto noslash; |
|
} |
if (isftpurl) |
if (isftpurl) |
goto noftpautologin; |
goto noftpautologin; |
warnx("Invalid URL (no `/' after host): %s", origline); |
warnx("Invalid URL (no `/' after host): %s", origline); |
goto cleanup_url_get; |
goto cleanup_url_get; |
} |
} |
*path++ = '\0'; |
*path++ = '\0'; |
if (EMPTYSTRING(path)) { |
if (EMPTYSTRING(path) && !outfile) { |
if (isftpurl) |
if (isftpurl) |
goto noftpautologin; |
goto noftpautologin; |
warnx("Invalid URL (no file after host): %s", origline); |
warnx("Invalid URL (no file after host): %s", origline); |
|
|
} |
} |
} |
} |
|
|
|
noslash: |
if (outfile) |
if (outfile) |
savefile = outfile; |
savefile = outfile; |
else |
else { |
savefile = basename(path); |
if (path[strlen(path) - 1] == '/') /* Consider no file */ |
|
savefile = NULL; /* after dir invalid. */ |
#ifndef SMALL |
else |
if (resume && (strcmp(savefile, "-") == 0)) { |
savefile = basename(path); |
warnx("can't append to stdout"); |
|
goto cleanup_url_get; |
|
} |
} |
#endif /* !SMALL */ |
|
|
|
if (EMPTYSTRING(savefile)) { |
if (EMPTYSTRING(savefile)) { |
if (isftpurl) |
if (isftpurl) |
|
|
goto cleanup_url_get; |
goto cleanup_url_get; |
} |
} |
|
|
|
#ifndef SMALL |
|
if (resume && (strcmp(savefile, "-") == 0)) { |
|
warnx("can't append to stdout"); |
|
goto cleanup_url_get; |
|
} |
|
#endif /* !SMALL */ |
|
|
if (!isfileurl && proxyenv != NULL) { /* use proxy */ |
if (!isfileurl && proxyenv != NULL) { /* use proxy */ |
#ifndef SMALL |
#ifndef SMALL |
if (ishttpsurl) { |
if (ishttpsurl) { |
|
|
warnx("Malformed proxy URL: %s", proxyenv); |
warnx("Malformed proxy URL: %s", proxyenv); |
goto cleanup_url_get; |
goto cleanup_url_get; |
} |
} |
*--path = '/'; /* add / back to real path */ |
if (*--path == '\0') |
|
*path = '/'; /* add / back to real path */ |
path = strchr(host, '/'); /* remove trailing / on host */ |
path = strchr(host, '/'); /* remove trailing / on host */ |
if (!EMPTYSTRING(path)) |
if (!EMPTYSTRING(path)) |
*path++ = '\0'; /* i guess this ++ is useless */ |
*path++ = '\0'; /* i guess this ++ is useless */ |