-/* $NetBSD: fetch.c,v 1.195 2011/12/10 05:53:58 lukem Exp $ */
+/* $NetBSD: fetch.c,v 1.198 2012/07/04 06:09:37 is Exp $ */
/*-
* Copyright (c) 1997-2009 The NetBSD Foundation, Inc.
#include <sys/cdefs.h>
#ifndef lint
-__RCSID("$NetBSD: fetch.c,v 1.195 2011/12/10 05:53:58 lukem Exp $");
+__RCSID("$NetBSD: fetch.c,v 1.198 2012/07/04 06:09:37 is Exp $");
#endif /* not lint */
/*
hints.ai_protocol = 0;
error = getaddrinfo(host, port, &hints, &res0);
if (error) {
- warnx("Can't lookup `%s:%s': %s", host, port,
+ warnx("Can't LOOKUP `%s:%s': %s", host, port,
(error == EAI_SYSTEM) ? strerror(errno)
: gai_strerror(error));
goto cleanup_fetch_url;
continue;
}
- if (ftp_connect(s, res->ai_addr, res->ai_addrlen) < 0) {
+ if (ftp_connect(s, res->ai_addr, res->ai_addrlen,
+ verbose || !res->ai_next) < 0) {
close(s);
s = -1;
continue;
go_fetch(const char *url)
{
char *proxyenv;
+ char *p;
#ifndef NO_ABOUT
/*
return (fetch_url(url, NULL, NULL, NULL));
/*
+ * If it contains "://" but does not begin with ftp://
+ * or something that was already handled, then it's
+ * unsupported.
+ *
+ * If it contains ":" but not "://" then we assume the
+ * part before the colon is a host name, not an URL scheme,
+ * so we don't try to match that here.
+ */
+ if ((p = strstr(url, "://")) != NULL && ! STRNEQUAL(url, FTP_URL))
+ errx(1, "Unsupported URL scheme `%.*s'", (int)(p - url), url);
+
+ /*
* Try FTP URL-style and host:file arguments next.
* If ftpproxy is set with an FTP URL, use fetch_url()
* Othewise, use fetch_ftp().