diff options
Diffstat (limited to 'contrib/lukemftp/src/fetch.c')
-rw-r--r-- | contrib/lukemftp/src/fetch.c | 27 |
1 files changed, 16 insertions, 11 deletions
diff --git a/contrib/lukemftp/src/fetch.c b/contrib/lukemftp/src/fetch.c index b442e0c..c17a051 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, |