aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/lukemftp/src/fetch.c
diff options
context:
space:
mode:
authorMike Heffner <mikeh@FreeBSD.org>2003-11-03 17:12:09 +0000
committerMike Heffner <mikeh@FreeBSD.org>2003-11-03 17:12:09 +0000
commit0e54ef8be7e8aae6d1a1919f34d62ef4a6222e67 (patch)
tree149b77e7c8077415f504e4fda9334e22732b7522 /contrib/lukemftp/src/fetch.c
parentfa547236e73511be4f1289da4969cbc7a3c12798 (diff)
downloadsrc-0e54ef8be7e8aae6d1a1919f34d62ef4a6222e67.tar.gz
src-0e54ef8be7e8aae6d1a1919f34d62ef4a6222e67.zip
Import latest CVS lukemftp.
Notes
Notes: svn path=/vendor/lukemftp/dist/; revision=121966
Diffstat (limited to 'contrib/lukemftp/src/fetch.c')
-rw-r--r--contrib/lukemftp/src/fetch.c27
1 files changed, 16 insertions, 11 deletions
diff --git a/contrib/lukemftp/src/fetch.c b/contrib/lukemftp/src/fetch.c
index b442e0cf5037..c17a051e4001 100644
--- a/contrib/lukemftp/src/fetch.c
+++ b/contrib/lukemftp/src/fetch.c
@@ -1,4 +1,4 @@
-/* $NetBSD: fetch.c,v 1.141 2003/05/14 14:31:00 wiz Exp $ */
+/* $NetBSD: fetch.c,v 1.144 2003/07/31 05:23:59 lukem Exp $ */
/*-
* Copyright (c) 1997-2003 The NetBSD Foundation, Inc.
@@ -41,7 +41,7 @@
#include <sys/cdefs.h>
#ifndef lint
-__RCSID("$NetBSD: fetch.c,v 1.141 2003/05/14 14:31:00 wiz Exp $");
+__RCSID("$NetBSD: fetch.c,v 1.144 2003/07/31 05:23:59 lukem Exp $");
#endif /* not lint */
/*
@@ -438,7 +438,7 @@ fetch_url(const char *url, const char *proxyenv, char *proxyauth, char *wwwauth)
char *cp, *ep, *buf, *savefile;
char *auth, *location, *message;
char *user, *pass, *host, *port, *path, *decodedpath;
- char *puser, *ppass;
+ char *puser, *ppass, *useragent;
off_t hashbytes, rangestart, rangeend, entitylen;
int (*closefunc)(FILE *);
FILE *fin, *fout;
@@ -666,9 +666,8 @@ fetch_url(const char *url, const char *proxyenv, char *proxyauth, char *wwwauth)
*/
ai_unmapped(res);
if (getnameinfo(res->ai_addr, res->ai_addrlen,
- hbuf, sizeof(hbuf), NULL, 0,
- NI_NUMERICHOST) != 0)
- strncpy(hbuf, "invalid", sizeof(hbuf));
+ hbuf, sizeof(hbuf), NULL, 0, NI_NUMERICHOST) != 0)
+ strlcpy(hbuf, "invalid", sizeof(hbuf));
if (verbose && res != res0)
fprintf(ttyout, "Trying %s...\n", hbuf);
@@ -752,7 +751,12 @@ fetch_url(const char *url, const char *proxyenv, char *proxyauth, char *wwwauth)
if (flushcache)
fprintf(fin, "Cache-Control: no-cache\r\n");
}
- fprintf(fin, "User-Agent: %s/%s\r\n", FTP_PRODUCT, FTP_VERSION);
+ if ((useragent=getenv("FTPUSERAGENT")) != NULL) {
+ fprintf(fin, "User-Agent: %s\r\n", useragent);
+ } else {
+ fprintf(fin, "User-Agent: %s/%s\r\n",
+ FTP_PRODUCT, FTP_VERSION);
+ }
if (wwwauth) {
if (verbose) {
fprintf(ttyout, "%swith authorization",
@@ -1620,18 +1624,19 @@ go_fetch(const char *url)
*/
if (strncasecmp(url, ABOUT_URL, sizeof(ABOUT_URL) - 1) == 0) {
url += sizeof(ABOUT_URL) -1;
- if (strcasecmp(url, "ftp") == 0) {
+ if (strcasecmp(url, "ftp") == 0 ||
+ strcasecmp(url, "tnftp") == 0) {
fputs(
-"This version of ftp has been enhanced by Luke Mewburn <lukem@netbsd.org>\n"
+"This version of ftp has been enhanced by Luke Mewburn <lukem@NetBSD.org>\n"
"for the NetBSD project. Execute `man ftp' for more details.\n", ttyout);
} else if (strcasecmp(url, "lukem") == 0) {
fputs(
"Luke Mewburn is the author of most of the enhancements in this ftp client.\n"
-"Please email feedback to <lukem@netbsd.org>.\n", ttyout);
+"Please email feedback to <lukem@NetBSD.org>.\n", ttyout);
} else if (strcasecmp(url, "netbsd") == 0) {
fputs(
"NetBSD is a freely available and redistributable UNIX-like operating system.\n"
-"For more information, see http://www.netbsd.org/index.html\n", ttyout);
+"For more information, see http://www.NetBSD.org/\n", ttyout);
} else if (strcasecmp(url, "version") == 0) {
fprintf(ttyout, "Version: %s %s%s\n",
FTP_PRODUCT, FTP_VERSION,