From inoue@argv.org  Fri Jul 28 20:48:49 2000
Return-Path: <inoue@argv.org>
Received: from t-mta4.odn.ne.jp (mfep4.odn.ne.jp [143.90.131.182])
	by hub.freebsd.org (Postfix) with ESMTP id 9206537B819
	for <FreeBSD-gnats-submit@freebsd.org>; Fri, 28 Jul 2000 20:48:47 -0700 (PDT)
	(envelope-from inoue@argv.org)
Received: from windy.src.argv.org ([210.197.172.113]) by t-mta4.odn.ne.jp
          (InterMail vM.4.01.02.27 201-229-119-110) with ESMTP
          id <20000729034845187.UBVC.882.t-mta4.odn.ne.jp@mta4.odn.ne.jp>
          for <FreeBSD-gnats-submit@freebsd.org>;
          Sat, 29 Jul 2000 12:48:45 +0900
Received: (from inoue@localhost)
	by windy.src.argv.org (8.9.3/3.7W) id MAA00787;
	Sat, 29 Jul 2000 12:48:44 +0900 (JST)
Message-Id: <200007290348.MAA00787@windy.src.argv.org>
Date: Sat, 29 Jul 2000 12:48:44 +0900 (JST)
From: inoue@argv.org
Reply-To: inoue@argv.org
To: FreeBSD-gnats-submit@freebsd.org
Subject: fetch failes when Content-Length header doesn't exist
X-Send-Pr-Version: 3.2

>Number:         20279
>Category:       bin
>Synopsis:       fetch command fails when Content-Length HTTP header is not given
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    gnats-admin
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Fri Jul 28 20:50:00 PDT 2000
>Closed-Date:    Wed Aug 2 06:02:58 PDT 2000
>Last-Modified:  Wed Oct 26 05:53:36 GMT 2005
>Originator:     Koichi INOUE
>Release:        FreeBSD 4.1-STABLE i386
>Organization:
Accessibility Research Group for the Visually-Impaired
>Environment:

on any i386 (and alpha?) environment.
CPU: Pentium III/450Mhz
Mem: 128Mb
MB: AOpen AX6BC-R

>Description:

The command /usr/bin/fetch fails as follows.
This host doesn't give Content-Length header.

windy inoue$ /usr/bin/fetch http://www.asahi.com/paper/front.html
Receiving front.html (4294967295 bytes): 0%
24521 bytes transferred in 3.3 seconds (7.15 kBps)
fetch: front.html appears to be truncated: 24521/4294967295 bytes

>How-To-Repeat:

Ditto.
It happens with other url:
http://www.yomiuri.co.jp/
Both servers uses Netscape.

>Fix:

The following modification solved the problem. But I don't know why it suddenly started to fail these days. The type off_t and -1 may not be comparable? (by compiler optimization?)

--- /usr/src/usr.bin/fetch/fetch.c	Sat Jul 29 02:33:20 2000
+++ /usr/src/usr.bin/fetch/fetch.c.new	Sat Jul 29 02:05:58 2000
@@ -416,7 +416,7 @@
     }
 
     /* did the transfer complete normally? */
-    if (us.size != -1 && count < us.size) {
+    if ((int)us.size != -1 && count < us.size) {
 	warnx("%s appears to be truncated: %lld/%lld bytes",
 	      path, count, us.size);
 	goto failure_keep;

>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->closed 
State-Changed-By: des 
State-Changed-When: Wed Aug 2 06:02:58 PDT 2000 
State-Changed-Why:  
Duplicate commit. 

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