svn commit: r192073 - stable/7/usr.bin/fetch

Dag-Erling Smorgrav des at FreeBSD.org
Thu May 14 02:07:42 UTC 2009


Author: des
Date: Thu May 14 02:07:41 2009
New Revision: 192073
URL: http://svn.freebsd.org/changeset/base/192073

Log:
  MFC 185912: Apply the same defaults to HTTPS as to HTTP.
  MFC 187361: Fix FTP / HTTP timeouts

Modified:
  stable/7/usr.bin/fetch/   (props changed)
  stable/7/usr.bin/fetch/fetch.c

Modified: stable/7/usr.bin/fetch/fetch.c
==============================================================================
--- stable/7/usr.bin/fetch/fetch.c	Thu May 14 02:00:50 2009	(r192072)
+++ stable/7/usr.bin/fetch/fetch.c	Thu May 14 02:07:41 2009	(r192073)
@@ -1,5 +1,5 @@
 /*-
- * Copyright (c) 2000-2004 Dag-Erling Coïdan Smørgrav
+ * Copyright (c) 2000-2004 Dag-Erling Coïdan Smørgrav
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -48,6 +48,7 @@ __FBSDID("$FreeBSD$");
 #include <fetch.h>
 
 #define MINBUFSIZE	4096
+#define TIMEOUT		120
 
 /* Option flags */
 int	 A_flag;	/*    -A: do not follow 302 redirects */
@@ -75,7 +76,7 @@ int	 R_flag;	/*    -R: don't delete part
 int	 r_flag;	/*    -r: restart previously interrupted transfer */
 off_t	 S_size;        /*    -S: require size to match */
 int	 s_flag;        /*    -s: show size, don't fetch */
-long	 T_secs = 120;	/*    -T: transfer timeout in seconds */
+long	 T_secs;	/*    -T: transfer timeout in seconds */
 int	 t_flag;	/*!   -t: workaround TCP bug */
 int	 U_flag;	/*    -U: do not use high ports */
 int	 v_level = 1;	/*    -v: verbosity level */
@@ -88,8 +89,8 @@ int	 sigalrm;	/* SIGALRM received */
 int	 siginfo;	/* SIGINFO received */
 int	 sigint;	/* SIGINT received */
 
-long	 ftp_timeout;	/* default timeout for FTP transfers */
-long	 http_timeout;	/* default timeout for HTTP transfers */
+long	 ftp_timeout = TIMEOUT;		/* default timeout for FTP transfers */
+long	 http_timeout = TIMEOUT;	/* default timeout for HTTP transfers */
 char	*buf;		/* transfer buffer */
 
 
@@ -376,7 +377,8 @@ fetch(char *URL, const char *path)
 	}
 
 	/* HTTP specific flags */
-	if (strcmp(url->scheme, SCHEME_HTTP) == 0) {
+	if (strcmp(url->scheme, SCHEME_HTTP) == 0 ||
+	    strcmp(url->scheme, SCHEME_HTTPS) == 0) {
 		if (d_flag)
 			strcat(flags, "d");
 		if (A_flag)


More information about the svn-src-stable-7 mailing list