version 1.174, 2019/10/13 15:09:26 |
version 1.175, 2019/10/23 16:47:53 |
|
|
#include <netdb.h> |
#include <netdb.h> |
#include <fcntl.h> |
#include <fcntl.h> |
#include <signal.h> |
#include <signal.h> |
|
#include <vis.h> |
#include <stdio.h> |
#include <stdio.h> |
#include <stdarg.h> |
#include <stdarg.h> |
#include <errno.h> |
#include <errno.h> |
|
|
{ |
{ |
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; |
char *epath, *redirurl, *loctail, *h, *p, gerror[200]; |
int error, i, isftpurl = 0, isfileurl = 0, isredirect = 0, rval = -1; |
int error, i, isftpurl = 0, isfileurl = 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; |
|
|
strlcpy(ststr, cp, sizeof(ststr)); |
strlcpy(ststr, cp, sizeof(ststr)); |
status = strtonum(ststr, 200, 503, &errstr); |
status = strtonum(ststr, 200, 503, &errstr); |
if (errstr) { |
if (errstr) { |
warnx("Error retrieving file: %s", cp); |
strnvis(gerror, cp, sizeof gerror, VIS_SAFE); |
|
warnx("Error retrieving %s: %s", origline, gerror); |
goto cleanup_url_get; |
goto cleanup_url_get; |
} |
} |
|
|
|
|
isunavail = 1; |
isunavail = 1; |
break; |
break; |
default: |
default: |
warnx("Error retrieving file: %s", cp); |
strnvis(gerror, cp, sizeof gerror, VIS_SAFE); |
|
warnx("Error retrieving %s: %s", origline, gerror); |
goto cleanup_url_get; |
goto cleanup_url_get; |
} |
} |
|
|
|
|
|
|
if (isunavail) { |
if (isunavail) { |
if (retried || retryafter != 0) |
if (retried || retryafter != 0) |
warnx("Error retrieving file: 503 Service Unavailable"); |
warnx("Error retrieving %s: 503 Service Unavailable", |
|
origline); |
else { |
else { |
if (verbose) |
if (verbose) |
fprintf(ttyout, "Retrying %s\n", origline); |
fprintf(ttyout, "Retrying %s\n", origline); |