NetBSD Problem Report #45116

From www@NetBSD.org  Mon Jul  4 11:57:37 2011
Return-Path: <www@NetBSD.org>
Received: from mail.netbsd.org (mail.netbsd.org [204.152.190.11])
	by www.NetBSD.org (Postfix) with ESMTP id DC4B663C89B
	for <gnats-bugs@gnats.NetBSD.org>; Mon,  4 Jul 2011 11:57:36 +0000 (UTC)
Message-Id: <20110704115736.0761E63C892@www.NetBSD.org>
Date: Mon,  4 Jul 2011 11:57:36 +0000 (UTC)
From: mspo@netbsd.org
Reply-To: mspo@netbsd.org
To: gnats-bugs@NetBSD.org
Subject: /usr/bin/ftp fails to parse Content-Range header
X-Send-Pr-Version: www-1.0

>Number:         45116
>Category:       bin
>Synopsis:       /usr/bin/ftp fails to parse Content-Range header
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    lukem
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Jul 04 12:00:00 +0000 2011
>Closed-Date:    Sat Jun 16 07:26:39 +0000 2012
>Last-Modified:  Sat Jun 16 07:26:39 +0000 2012
>Originator:     Matthew Sporleder
>Release:        5.1
>Organization:
netbsd
>Environment:
NetBSD vc136-15.vc.panix.com 5.1 NetBSD 5.1 (PANIX-VC) #0: Thu Mar 10 01:49:14 EST 2011  root@juggler.panix.com:/misc/obj/misc/devel/netbsd/5.1/src/sys/arch/amd64/compile/PANIX-VC amd64
>Description:
I believe the parsing of Content-Range headers is broken in ftp.  This is affecting a few packages in pkgsrc.
>How-To-Repeat:
ucspi-tcp $ ftp -d http://www.fefe.de/ucspi/ucspi-tcp-0.88-ipv6.diff19.bz2

isipv6addr: got 0 for http://www.fefe.de/ucspi/ucspi-tcp-0.88-ipv6.diff19.bz2
fetch_url: `http://www.fefe.de/ucspi/ucspi-tcp-0.88-ipv6.diff19.bz2' proxyenv `<null>'
parse_url: URL `http://www.fefe.de/ucspi/ucspi-tcp-0.88-ipv6.diff19.bz2'
parse_url: user `<null>' pass `<null>' host www.fefe.de port http(80) path `/ucspi/ucspi-tcp-0.88-ipv6.diff19.bz2'
fetch_url: savefile `ucspi-tcp-0.88-ipv6.diff19.bz2'
Requesting http://www.fefe.de/ucspi/ucspi-tcp-0.88-ipv6.diff19.bz2
fetch_url: received `HTTP/1.1 200 Coming Up'
fetch_url: received `Accept-Ranges: bytes'
fetch_url: received `Server: Gatling/0.12'
fetch_url: received `Content-Type: application/octet-stream'
fetch_url: received `Content-Length: 22632'
fetch_url: parsed len as: 22632
fetch_url: received `Date: Mon, 04 Jul 2011 11:45:12 GMT'
fetch_url: received `Last-Modified: Thu, 19 Mar 2009 11:46:48 GMT'
parsed date as: Thu, 19 Mar 2009 07:46:48 -0400
fetch_url: received `Content-Range: bytes 0-22631/22632'
parsed range as: 0-22631/22632
ftp: Received unexpected Content-Range header

>Fix:

>Release-Note:

>Audit-Trail:

Responsible-Changed-From-To: bin-bug-people->lukem
Responsible-Changed-By: lukem@NetBSD.org
Responsible-Changed-When: Sat, 09 Jul 2011 10:39:13 +0000
Responsible-Changed-Why:
I'll take a look


From: Luke Mewburn <lukem@NetBSD.org>
To: gnats-bugs@NetBSD.org
Cc: gnats-admin@netbsd.org, netbsd-bugs@netbsd.org
Subject: Re: bin/45116: /usr/bin/ftp fails to parse Content-Range header
Date: Sun, 17 Jul 2011 19:40:01 +1000

 --HjGz34yYE1BNnn/x
 Content-Type: text/plain; charset=us-ascii
 Content-Disposition: inline
 Content-Transfer-Encoding: quoted-printable

 On Mon, Jul 04, 2011 at 12:00:00PM +0000, mspo@netbsd.org wrote:
   | >Number:         45116
   | >Category:       bin
   | >Synopsis:       /usr/bin/ftp fails to parse Content-Range header
   | I believe the parsing of Content-Range headers is broken in ftp.  This =
 is affecting a few packages in pkgsrc.
   | >How-To-Repeat:
   | ucspi-tcp $ ftp -d http://www.fefe.de/ucspi/ucspi-tcp-0.88-ipv6.diff19.=
 bz2
   |=20
   | isipv6addr: got 0 for http://www.fefe.de/ucspi/ucspi-tcp-0.88-ipv6.diff=
 19.bz2
   | fetch_url: `http://www.fefe.de/ucspi/ucspi-tcp-0.88-ipv6.diff19.bz2' pr=
 oxyenv `<null>'
   | parse_url: URL `http://www.fefe.de/ucspi/ucspi-tcp-0.88-ipv6.diff19.bz2'
   | parse_url: user `<null>' pass `<null>' host www.fefe.de port http(80) p=
 ath `/ucspi/ucspi-tcp-0.88-ipv6.diff19.bz2'
   | fetch_url: savefile `ucspi-tcp-0.88-ipv6.diff19.bz2'
   | Requesting http://www.fefe.de/ucspi/ucspi-tcp-0.88-ipv6.diff19.bz2
   | fetch_url: received `HTTP/1.1 200 Coming Up'
   | fetch_url: received `Accept-Ranges: bytes'
   | fetch_url: received `Server: Gatling/0.12'
   | fetch_url: received `Content-Type: application/octet-stream'
   | fetch_url: received `Content-Length: 22632'
   | fetch_url: parsed len as: 22632
   | fetch_url: received `Date: Mon, 04 Jul 2011 11:45:12 GMT'
   | fetch_url: received `Last-Modified: Thu, 19 Mar 2009 11:46:48 GMT'
   | parsed date as: Thu, 19 Mar 2009 07:46:48 -0400
   | fetch_url: received `Content-Range: bytes 0-22631/22632'
   | parsed range as: 0-22631/22632
   | ftp: Received unexpected Content-Range header

 I'm researching this issue.

 It looks like the http server (Gatling/0.12) is incorrectly sending
 a Content-Range response that wasn't requested (ftp didn't send a
 Range header in the request since you didn't use -R).

 It's also possible that the server has another bug in that it
 sends Content-Range in a reponse that isn't 206.

 I'm getting clarification from a member of the HTTP working group.

 --HjGz34yYE1BNnn/x
 Content-Type: application/pgp-signature

 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1.4.11 (NetBSD)

 iEYEARECAAYFAk4irfAACgkQpBhtmn8zJHK4CQCgl34+OJvdUqc4/qYbtpZyaQVd
 G+UAn3VPg8Fjo1NXLj56eWWd96DmamjA
 =lbUu
 -----END PGP SIGNATURE-----

 --HjGz34yYE1BNnn/x--

State-Changed-From-To: open->analyzed
State-Changed-By: lukem@NetBSD.org
State-Changed-When: Sat, 24 Dec 2011 00:45:04 +0000
State-Changed-Why:
I brought this up with the chair of the IETF HTTPbis WG - that group
is chartered to revise & clarify HTTP 2616 (HTTP 1.1).
It was confirmed that the behaviour of ftp is correct, and the foreign
web server is incorrect.  I.e, ftp didn't ask for a Range, so it shouldn't
be getting a Content-Range response (especially without a 206 response).
See: http://trac.tools.ietf.org/wg/httpbis/trac/ticket/301

Whilst the http handling in ftp could be improved, in this case I
don't believe that it has faulty behaviour.


From: "Matthew Sporleder (mspo.com)" <mspo@mspo.com>
To: gnats-bugs@NetBSD.org
Cc: lukem@NetBSD.org, netbsd-bugs@netbsd.org, gnats-admin@netbsd.org,
	mspo@netbsd.org
Subject: Re: bin/45116 (/usr/bin/ftp fails to parse Content-Range header)
Date: Fri, 23 Dec 2011 21:28:29 -0500

 I have emailed fefe.de with this information.

State-Changed-From-To: analyzed->closed
State-Changed-By: lukem@NetBSD.org
State-Changed-When: Sat, 16 Jun 2012 07:26:39 +0000
State-Changed-Why:
http server isn't RFC compliant.
Adding workarounds for bugs in uncommon web servers would unnecessarily
bloat ftp and/or break other behaviour.


>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2007 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.