summaryrefslogtreecommitdiffstats
path: root/usr.bin/fetch
diff options
context:
space:
mode:
authorwollman <wollman@FreeBSD.org>1997-07-25 19:35:44 +0000
committerwollman <wollman@FreeBSD.org>1997-07-25 19:35:44 +0000
commit021417e0de807dffe85f2ebec2dd9b568d4e545d (patch)
tree92d27f5303ecd82c9c43c4b36dda876cb15a0ca5 /usr.bin/fetch
parentcd0c23d19a3bde32cd2e62400904f9074c24db05 (diff)
downloadFreeBSD-src-021417e0de807dffe85f2ebec2dd9b568d4e545d.zip
FreeBSD-src-021417e0de807dffe85f2ebec2dd9b568d4e545d.tar.gz
Provide a new `-b' flag to work around some broken HTTP/TCP implementations
that can't deal with a half-closed connection.
Diffstat (limited to 'usr.bin/fetch')
-rw-r--r--usr.bin/fetch/fetch.114
-rw-r--r--usr.bin/fetch/fetch.h3
-rw-r--r--usr.bin/fetch/http.c6
-rw-r--r--usr.bin/fetch/main.c11
4 files changed, 25 insertions, 9 deletions
diff --git a/usr.bin/fetch/fetch.1 b/usr.bin/fetch/fetch.1
index 924e867..8fe3e0b5 100644
--- a/usr.bin/fetch/fetch.1
+++ b/usr.bin/fetch/fetch.1
@@ -1,4 +1,4 @@
-.\" $Id: fetch.1,v 1.16 1997/02/22 23:43:32 wosch Exp $
+.\" $Id: fetch.1,v 1.17 1997/03/05 18:57:15 fenner Exp $
.Dd July 2, 1996
.Dt FETCH 1
.Os FreeBSD 2.2
@@ -7,7 +7,7 @@
.Nd retrieve a file by Uniform Resource Locator
.Sh SYNOPSIS
.Nm fetch
-.Op Fl MPamnpqr
+.Op Fl MPabmnpqr
.Op Fl o Ar file
.Ar URL
.Op Ar ...
@@ -48,6 +48,12 @@ The following options are available:
.Bl -tag -width Fl
.It Fl a
Automatically retry the transfer upon soft failures.
+.It Fl b
+Work around a bug in some
+.Tn HTTP
+servers which fail to correctly implement the
+.Tn TCP
+protocol.
.It Fl c Ar dir
The file to retrieve is in directory
.Ar dir
@@ -301,3 +307,7 @@ Only the
authentication mode is implemented for
.Tn HTTP .
This should be replaced by digest authentication.
+.Pp
+The
+.Fl b
+flag should not be necessary.
diff --git a/usr.bin/fetch/fetch.h b/usr.bin/fetch/fetch.h
index 321af11..d885b23 100644
--- a/usr.bin/fetch/fetch.h
+++ b/usr.bin/fetch/fetch.h
@@ -26,7 +26,7 @@
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: fetch.h,v 1.2 1997/01/31 19:55:49 wollman Exp $
+ * $Id: fetch.h,v 1.3 1997/02/05 19:59:10 wollman Exp $
*/
#ifndef fetch_h
@@ -49,6 +49,7 @@ struct fetch_state {
int fs_linkfile; /* -l option */
int fs_precious; /* -R option */
int fs_auto_retry; /* -a option */
+ int fs_linux_bug; /* -b option */
time_t fs_modtime;
void *fs_proto;
int (*fs_retrieve)(struct fetch_state *);
diff --git a/usr.bin/fetch/http.c b/usr.bin/fetch/http.c
index fa445e0..222c6ea 100644
--- a/usr.bin/fetch/http.c
+++ b/usr.bin/fetch/http.c
@@ -26,7 +26,7 @@
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: http.c,v 1.5 1997/03/05 18:57:16 fenner Exp $
+ * $Id: http.c,v 1.6 1997/03/06 20:01:32 jmg Exp $
*/
#include <sys/types.h>
@@ -483,7 +483,7 @@ http_retrieve(struct fetch_state *fs)
n = 0;
msg.msg_control = 0;
msg.msg_controllen = 0;
- msg.msg_flags = MSG_EOF;
+ msg.msg_flags = fs->fs_linux_bug ? 0 : MSG_EOF;
#define addstr(Iov, N, Str) \
do { \
@@ -575,7 +575,7 @@ retry:
fs->fs_status = "sending request message";
setup_sigalrm();
alarm(timo);
- if (sendmsg(s, &msg, MSG_EOF) < 0) {
+ if (sendmsg(s, &msg, fs->fs_linux_bug ? 0 : MSG_EOF) < 0) {
warn("sendmsg: %s", https->http_hostname);
fclose(remote);
return EX_OSERR;
diff --git a/usr.bin/fetch/main.c b/usr.bin/fetch/main.c
index 999aff6..a45486e 100644
--- a/usr.bin/fetch/main.c
+++ b/usr.bin/fetch/main.c
@@ -24,7 +24,7 @@
* SUCH DAMAGE.
*/
-/* $Id: main.c,v 1.39 1997/07/01 06:37:34 charnier Exp $ */
+/* $Id: main.c,v 1.40 1997/07/02 06:28:32 charnier Exp $ */
#include <sys/types.h>
@@ -73,7 +73,7 @@ main(int argc, char *const *argv)
fs.fs_verbose = 1;
change_to_dir = file_to_get = hostname = 0;
- while ((c = getopt(argc, argv, "ac:D:f:h:HilLmMnNo:pPqRrT:vV:")) != -1) {
+ while ((c = getopt(argc, argv, "abc:D:f:h:HilLmMnNo:pPqRrT:vV:")) != -1) {
switch (c) {
case 'D': case 'H': case 'I': case 'N': case 'L': case 'V':
break; /* ncftp compatibility */
@@ -81,10 +81,15 @@ main(int argc, char *const *argv)
case 'a':
fs.fs_auto_retry = 1;
break;
+
+ case 'b':
+ fs.fs_linux_bug = 1;
+ break;
+
case 'c':
change_to_dir = optarg;
break;
-
+
case 'f':
file_to_get = optarg;
break;
OpenPOWER on IntegriCloud