Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 17 May 2000 03:52:43 +0900 (JST)
From:      Hajimu UMEMOTO (=?ISO-2022-JP?B?GyRCR19LXBsoQiA=?=  =?ISO-2022-JP?B?GyRCSCUbKEI=?=) <ume@mahoroba.org>
To:        des@flood.ping.uio.no
Cc:        arch@freebsd.org
Subject:   Re: fetch(1)
Message-ID:  <200005161852.e4GIqhF74521@peace.mahoroba.org>
In-Reply-To: <xzpog68i71b.fsf@flood.ping.uio.no>
References:  <xzpbt2djcj4.fsf@flood.ping.uio.no> <200005122016.e4CKGtF38185@peace.mahoroba.org> <xzpog68i71b.fsf@flood.ping.uio.no>

next in thread | previous in thread | raw e-mail | index | archive | help
>>>>> On 15 May 2000 09:53:04 +0200
>>>>> Dag-Erling Smorgrav <des@flood.ping.uio.no> said:

> Your fetch(1) doesn't handle content size correctly on some case.  If
> HTTP server doesn't reply Content-Length:, fetchStat()
> (fetchStatHTTP()) doesn't return -1 and doesn't touch us.size.  Then,
> the value of us.size stays unknown.

des> That's a bug in fetchStatHTTP(), thanks for pointing it out.

You are welcome.
There is one more problem.  If us.size is -1 with HTTP, gotten file is
shorten than original one.
This change seems to fix it.

Index: http.c
===================================================================
RCS file: /home/ncvs/src/lib/libfetch/http.c,v
retrieving revision 1.18
diff -u -r1.18 http.c
--- http.c	2000/05/15 09:05:36	1.18
+++ http.c	2000/05/16 18:53:46
@@ -135,6 +135,8 @@
     } else if (c->encoding == ENC_CHUNKED) {
 	if (c->chunksize == 0) {
 	    ln = fgetln(c->real_f, &len);
+	    if (len <= 2)
+		return NULL;
 	    DEBUG(fprintf(stderr, "\033[1m_http_fillbuf(): new chunk: "
 			  "%*.*s\033[m\n", (int)len-2, (int)len-2, ln));
 	    sscanf(ln, "%x", &(c->chunksize));

--
Hajimu UMEMOTO @ Internet Mutual Aid Society Yokohama, Japan
ume@mahoroba.org  ume@bisd.hitachi.co.jp  ume@FreeBSD.org
http://www.imasy.org/~ume/


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-arch" in the body of the message




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