Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 4 Mar 1997 00:07:47 -0700 (MST)
From:      marcs@znep.com
To:        FreeBSD-gnats-submit@freebsd.org
Subject:   bin/2870: fetch won't restart http transfers
Message-ID:  <199703040707.AAA28947@valis.worldgate.com>
Resent-Message-ID: <199703040710.XAA01724@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         2870
>Category:       bin
>Synopsis:       fetch -r just doesn't work for http transfers
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          open
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon Mar  3 23:10:01 PST 1997
>Last-Modified:
>Originator:     Marc Slemko
>Organization:
>Release:        FreeBSD 2.2-GAMMA i386
>Environment:

Latest fetch, from 2.2 or -current.

>Description:

When you try to use fetch -r against a http server to resume a
transfer, it will always give an error about "unknown Content-Range
unit".  

Once I fixed that problem, it was then filling the start of the
file with null characters when it was resumed.

>How-To-Repeat:

$ fetch http://localhost/~marcs/epi-r06.pdf
^C (abort partway through the file)
$ fetch -r http://localhost/~marcs/epi-r06.pdf



>Fix:

The following fixes the problem, and I _think_ it shouldn't
cause any other problems but have not had time to look at it in 
detail.  After this patch, fetch restarts http transfers fine for
me, although it still doesn't quite do chunked encodings properly...

Index: http.c
===================================================================
RCS file: /usr/cvs/src/usr.bin/fetch/http.c,v
retrieving revision 1.4
diff -c -r1.4 http.c
*** http.c	1997/02/11 20:46:05	1.4
--- http.c	1997/03/04 06:57:47
***************
*** 857,863 ****
  	if (to_stdout)
  		local = fopen("/dev/stdout", "w");
  	else
! 		local = fopen(fs->fs_outputfile, "w");
  	if (local == 0) {
  		warn("%s: fopen", fs->fs_outputfile);
  		fclose(remote);
--- 857,863 ----
  	if (to_stdout)
  		local = fopen("/dev/stdout", "w");
  	else
! 		local = fopen(fs->fs_outputfile, "a");
  	if (local == 0) {
  		warn("%s: fopen", fs->fs_outputfile);
  		fclose(remote);
***************
*** 1263,1269 ****
  	u_quad_t first, last, total;
  	char *ep;
  
! 	if (strcasecmp(orig, "bytes") != 0) {
  		warnx("unknown Content-Range unit: `%s'", orig);
  		return EX_PROTOCOL;
  	}
--- 1263,1269 ----
  	u_quad_t first, last, total;
  	char *ep;
  
! 	if (strncasecmp(orig, "bytes", 5) != 0) {
  		warnx("unknown Content-Range unit: `%s'", orig);
  		return EX_PROTOCOL;
  	}
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199703040707.AAA28947>