From nobody@FreeBSD.org  Thu Aug 26 14:25:44 2004
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id 7EBCC16A4CE
	for <freebsd-gnats-submit@FreeBSD.org>; Thu, 26 Aug 2004 14:25:44 +0000 (GMT)
Received: from www.freebsd.org (www.freebsd.org [216.136.204.117])
	by mx1.FreeBSD.org (Postfix) with ESMTP id 7080C43D67
	for <freebsd-gnats-submit@FreeBSD.org>; Thu, 26 Aug 2004 14:25:44 +0000 (GMT)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (localhost [127.0.0.1])
	by www.freebsd.org (8.12.11/8.12.11) with ESMTP id i7QEPiBH085795
	for <freebsd-gnats-submit@FreeBSD.org>; Thu, 26 Aug 2004 14:25:44 GMT
	(envelope-from nobody@www.freebsd.org)
Received: (from nobody@localhost)
	by www.freebsd.org (8.12.11/8.12.11/Submit) id i7QEPiS2085794;
	Thu, 26 Aug 2004 14:25:44 GMT
	(envelope-from nobody)
Message-Id: <200408261425.i7QEPiS2085794@www.freebsd.org>
Date: Thu, 26 Aug 2004 14:25:44 GMT
From: SANETO Takanori <sanewo@ba2.so-net.ne.jp>
To: freebsd-gnats-submit@FreeBSD.org
Subject: fetch always use Range when file exists
X-Send-Pr-Version: www-2.3

>Number:         70992
>Category:       bin
>Synopsis:       fetch always use Range when file exists
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    des
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Thu Aug 26 14:30:26 GMT 2004
>Closed-Date:    Thu Aug 26 15:51:47 GMT 2004
>Last-Modified:  Thu Aug 26 15:51:47 GMT 2004
>Originator:     SANETO Takanori
>Release:        5.2-CURRENT
>Organization:
an individual
>Environment:
FreeBSD muse.sanewo.ddo.jp 5.2-CURRENT FreeBSD 5.2-CURRENT #321: Mon Aug 16 23:41:11 JST 2004     root@muse.sanewo.ddo.jp:/export/usr/obj/usr/src/sys/MUSE  i386
>Description:
      when the target file exists on localy, fetch always use Range: header. If the size of local file is equal to or greater than remote file, some http server returns "Range not supported" error and fetch fails.
Range should have been used only when -r option is specified.
>How-To-Repeat:
      Try fetching same file twice from, e.g. http://www.FreeBSD.org/ports/auditfile.tbz . You will get following error:

fetch: http://www.FreeBSD.org/ports/auditfile.tbz: Requested Range Not Satisfiable

>Fix:
      Following patch might fix the problem.

diff -u -r1.72 fetch.c
--- fetch.c     15 Aug 2004 22:22:35 -0000      1.72
+++ fetch.c     26 Aug 2004 14:24:44 -0000
@@ -418,7 +418,7 @@
        sb.st_size = -1;
        if (!o_stdout) {
                r = stat(path, &sb);
-               if (r == 0 && S_ISREG(sb.st_mode)) {
+               if (r == 0 && r_flag && S_ISREG(sb.st_mode)) {
                        url->offset = sb.st_size;
                } else {
                        /*

>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-bugs->des 
Responsible-Changed-By: arved 
Responsible-Changed-When: Thu Aug 26 14:41:35 GMT 2004 
Responsible-Changed-Why:  
Over to fetch maintainer 

http://www.freebsd.org/cgi/query-pr.cgi?pr=70992 
State-Changed-From-To: open->closed 
State-Changed-By: des 
State-Changed-When: Thu Aug 26 15:51:45 GMT 2004 
State-Changed-Why:  
Committed, thanks. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=70992 
>Unformatted:
