* $FTPUSERAGENT overrides the HTTP User-Agent header.
Based on patch from Douwe Kiela. * Add about:tnftp * Fix URL in about:netbsd * Crank version
This commit is contained in:
parent
18eb53cd22
commit
6f5fbdb6de
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: fetch.c,v 1.143 2003/07/26 20:34:13 salo 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.143 2003/07/26 20:34:13 salo Exp $");
|
||||
__RCSID("$NetBSD: fetch.c,v 1.144 2003/07/31 05:23:59 lukem Exp $");
|
||||
#endif /* not lint */
|
||||
|
||||
/*
|
||||
@ -437,7 +437,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;
|
||||
@ -750,7 +750,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",
|
||||
@ -1618,7 +1623,8 @@ 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"
|
||||
"for the NetBSD project. Execute `man ftp' for more details.\n", ttyout);
|
||||
@ -1629,7 +1635,7 @@ go_fetch(const char *url)
|
||||
} 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,
|
||||
|
@ -1,4 +1,4 @@
|
||||
.\" $NetBSD: ftp.1,v 1.98 2003/07/09 08:09:04 lukem Exp $
|
||||
.\" $NetBSD: ftp.1,v 1.99 2003/07/31 05:24:00 lukem Exp $
|
||||
.\"
|
||||
.\" Copyright (c) 1996-2003 The NetBSD Foundation, Inc.
|
||||
.\" All rights reserved.
|
||||
@ -68,7 +68,7 @@
|
||||
.\"
|
||||
.\" @(#)ftp.1 8.3 (Berkeley) 10/9/94
|
||||
.\"
|
||||
.Dd January 20, 2003
|
||||
.Dd July 31, 2003
|
||||
.Dt FTP 1
|
||||
.Os
|
||||
.Sh NAME
|
||||
@ -2186,6 +2186,11 @@ Default is port returned by a
|
||||
.Fn getservbyname
|
||||
lookup of
|
||||
.Dq ftpgate/tcp .
|
||||
.It Ev FTPUSERAGENT
|
||||
The value to send for the
|
||||
.Tn HTTP
|
||||
User-Agent
|
||||
header.
|
||||
.It Ev HOME
|
||||
For default location of a
|
||||
.Pa .netrc
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: version.h,v 1.31 2003/06/15 13:49:46 lukem Exp $ */
|
||||
/* $NetBSD: version.h,v 1.32 2003/07/31 05:24:01 lukem Exp $ */
|
||||
/*-
|
||||
* Copyright (c) 1999-2003 The NetBSD Foundation, Inc.
|
||||
* All rights reserved.
|
||||
@ -40,5 +40,5 @@
|
||||
#endif
|
||||
|
||||
#ifndef FTP_VERSION
|
||||
#define FTP_VERSION "20030615"
|
||||
#define FTP_VERSION "20030731"
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user