Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.bin/ftp * $FTPUSERAGENT overrides the HTTP User-Agent he...



details:   https://anonhg.NetBSD.org/src/rev/e9075ef809d1
branches:  trunk
changeset: 550135:e9075ef809d1
user:      lukem <lukem%NetBSD.org@localhost>
date:      Thu Jul 31 05:23:59 2003 +0000

description:
* $FTPUSERAGENT overrides the HTTP User-Agent header.
  Based on patch from Douwe Kiela.
* Add about:tnftp
* Fix URL in about:netbsd
* Crank version

diffstat:

 usr.bin/ftp/fetch.c   |  18 ++++++++++++------
 usr.bin/ftp/ftp.1     |   9 +++++++--
 usr.bin/ftp/version.h |   4 ++--
 3 files changed, 21 insertions(+), 10 deletions(-)

diffs (106 lines):

diff -r 652872521731 -r e9075ef809d1 usr.bin/ftp/fetch.c
--- a/usr.bin/ftp/fetch.c       Thu Jul 31 01:25:38 2003 +0000
+++ b/usr.bin/ftp/fetch.c       Thu Jul 31 05:23:59 2003 +0000
@@ -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 @@
        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 @@
                        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 @@
         */
        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@localhost>\n"
 "for the NetBSD project.  Execute `man ftp' for more details.\n", ttyout);
@@ -1629,7 +1635,7 @@
                } 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,
diff -r 652872521731 -r e9075ef809d1 usr.bin/ftp/ftp.1
--- a/usr.bin/ftp/ftp.1 Thu Jul 31 01:25:38 2003 +0000
+++ b/usr.bin/ftp/ftp.1 Thu Jul 31 05:23:59 2003 +0000
@@ -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 @@
 .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
diff -r 652872521731 -r e9075ef809d1 usr.bin/ftp/version.h
--- a/usr.bin/ftp/version.h     Thu Jul 31 01:25:38 2003 +0000
+++ b/usr.bin/ftp/version.h     Thu Jul 31 05:23:59 2003 +0000
@@ -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



Home | Main Index | Thread Index | Old Index