From edwin@mavetju.org  Wed Jan 12 10:34:43 2005
Return-Path: <edwin@mavetju.org>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id 12B1B16A4CF
	for <FreeBSD-gnats-submit@freebsd.org>; Wed, 12 Jan 2005 10:34:43 +0000 (GMT)
Received: from mail2out.barnet.com.au (mail2out.barnet.com.au [202.83.176.14])
	by mx1.FreeBSD.org (Postfix) with ESMTP id B7B3C43D2D
	for <FreeBSD-gnats-submit@freebsd.org>; Wed, 12 Jan 2005 10:34:41 +0000 (GMT)
	(envelope-from edwin@mavetju.org)
Received: by mail2out.barnet.com.au (Postfix, from userid 27)
	id 51E0A70744F; Wed, 12 Jan 2005 21:34:40 +1100 (EST)
Received: from mail2-auth.barnet.com.au (mail2.barnet.com.au [202.83.176.13])
	(using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))
	(Client CN "*.barnet.com.au", Issuer "BarNet Root Certificate Authority" (verified OK))
	by mail2.barnet.com.au (Postfix) with ESMTP id EB4C570744C
	for <FreeBSD-gnats-submit@freebsd.org>; Wed, 12 Jan 2005 21:34:39 +1100 (EST)
Received: from k7.mavetju (edwin-3.int.barnet.com.au [10.10.12.2])
	(using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))
	(Client CN "edwin.adsl.barnet.com.au", Issuer "BarNet Root Certificate Authority" (verified OK))
	by mail2-auth.barnet.com.au (Postfix) with ESMTP id 0E6AD707445
	for <FreeBSD-gnats-submit@freebsd.org>; Wed, 12 Jan 2005 21:34:39 +1100 (EST)
Received: by k7.mavetju (Postfix, from userid 1001)
	id 23250610F; Wed, 12 Jan 2005 21:34:37 +1100 (EST)
Message-Id: <20050112103437.23250610F@k7.mavetju>
Date: Wed, 12 Jan 2005 21:34:37 +1100 (EST)
From: Edwin Groothuis <edwin@mavetju.org>
Reply-To: Edwin Groothuis <edwin@mavetju.org>
To: FreeBSD-gnats-submit@freebsd.org
Cc:
Subject: fetch(1) doesn't like 401 errors with -A
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         76134
>Category:       bin
>Synopsis:       fetch(1) doesn't like 401 errors with -A
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          open
>Quarter:
>Keywords:
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Wed Jan 12 10:40:19 GMT 2005
>Closed-Date:
>Last-Modified:
>Originator:     Edwin Groothuis
>Release:        FreeBSD 5.2.1-RELEASE i386
>Organization:
-
>Environment:
FreeBSD mag.barnet.com.au 5.3-RELEASE FreeBSD 5.3-RELEASE #2: Mon Dec 13 13:18:03 EST 2004     root@mag.barnet.com.au:/usr/src/sys/i386/compile/mag  i386

-r-xr-xr-x  1 root  wheel  17116 Nov  5 12:26 /usr/bin/fetch
-r--r--r--  1 root  wheel  44252 Nov  5 12:24 /usr/lib/libfetch.so.3

(straight from the 5.3 mini ISO)

>Description:

	When running fetch with the -A parameter (Do not automatically
	follow ``temporary'' (302) redirects.) and receiving an 401
	status (Authentication required), fetch doesn't automatically
	retry.

>How-To-Repeat:

$ HTTP_AUTH='basic:*:I accept www.opensource.org/licenses/cpl:.' /usr/bin/fetch -vvvARr -S 301873 http://www.research.att.com/~gsf/download/tgz/INIT.2004-12-25.tgz
scheme:   [http]
user:     []
password: []
host:     [www.research.att.com]
port:     [0]
document: [/~gsf/download/tgz/INIT.2004-12-25.tgz]
---> www.research.att.com:80
looking up www.research.att.com
connecting to www.research.att.com:80
requesting http://www.research.att.com/~gsf/download/tgz/INIT.2004-12-25.tgz
>Fix:
	-
>Release-Note:
>Audit-Trail:
>Unformatted:
 >>> GET /~gsf/download/tgz/INIT.2004-12-25.tgz HTTP/1.1
 >>> Host: www.research.att.com
 >>> User-Agent: fetch libfetch/2.0
 >>> Range: bytes=7168-
 >>> Connection: close
 >>> 
 <<< HTTP/1.1 401 Authorization Required
 server requires authorization
 <<< Date: Wed, 12 Jan 2005 10:31:05 GMT
 <<< Server: Apache/1.3.27 (Unix) mod_perl/1.27 mod_ssl/2.8.12 OpenSSL/0.9.6g
 <<< WWW-Authenticate: Basic realm="(using a name and password to access downloads binds you to use the software only in accordance with the Common Public License)"
 <<< Connection: close
 <<< Transfer-Encoding: chunked
 <<< Content-Type: text/html
 <<< 
 fetch: http://www.research.att.com/~gsf/download/tgz/INIT.2004-12-25.tgz: Unauthorized
 
 
 And now without the -A:
 
 $ HTTP_AUTH='basic:*:I accept www.opensource.org/licenses/cpl:.' /usr/bin/fetch -vvvRr -S 301873 http://www.research.att.com/~gsf/download/tgz/INIT.2004-12-25.tgz
 scheme:   [http]
 user:     []
 password: []
 host:     [www.research.att.com]
 port:     [0]
 document: [/~gsf/download/tgz/INIT.2004-12-25.tgz]
 ---> www.research.att.com:80
 looking up www.research.att.com
 connecting to www.research.att.com:80
 requesting http://www.research.att.com/~gsf/download/tgz/INIT.2004-12-25.tgz
 >>> GET /~gsf/download/tgz/INIT.2004-12-25.tgz HTTP/1.1
 >>> Host: www.research.att.com
 >>> User-Agent: fetch libfetch/2.0
 >>> Range: bytes=7168-
 >>> Connection: close
 >>> 
 <<< HTTP/1.1 401 Authorization Required
 server requires authorization
 <<< Date: Wed, 12 Jan 2005 10:31:28 GMT
 <<< Server: Apache/1.3.27 (Unix) mod_perl/1.27 mod_ssl/2.8.12 OpenSSL/0.9.6g
 <<< WWW-Authenticate: Basic realm="(using a name and password to access downloads binds you to use the software only in accordance with the Common Public License)"
 <<< Connection: close
 <<< Transfer-Encoding: chunked
 <<< Content-Type: text/html
 <<< 
 ---> www.research.att.com:80
 looking up www.research.att.com
 connecting to www.research.att.com:80
 requesting http://www.research.att.com/~gsf/download/tgz/INIT.2004-12-25.tgz
 >>> GET /~gsf/download/tgz/INIT.2004-12-25.tgz HTTP/1.1
 >>> Host: www.research.att.com
 usr: [I accept www.opensource.org/licenses/cpl]
 pwd: [.]
 >>> Authorization: Basic SSBhY2NlcHQgd3d3Lm9wZW5zb3VyY2Uub3JnL2xpY2Vuc2VzL2NwbDou
 >>> User-Agent: fetch libfetch/2.0
 >>> Range: bytes=7168-
 >>> Connection: close
 >>> 
 <<< HTTP/1.1 206 Partial Content
 <<< Date: Wed, 12 Jan 2005 10:31:30 GMT
 <<< Server: Apache/1.3.27 (Unix) mod_perl/1.27 mod_ssl/2.8.12 OpenSSL/0.9.6g
 <<< Last-Modified: Wed, 29 Dec 2004 03:25:30 GMT
 last modified: [2004-12-29 03:25:30]
 <<< ETag: "5d37bf1-49b31-41d223aa"
 <<< Accept-Ranges: bytes
 <<< Content-Length: 294705
 content length: [294705]
 <<< Content-Range: bytes 7168-301872/301873
 content range: [7168-301872/301873]
 <<< Connection: close
 <<< Content-Type: application/octet-stream
 <<< 
 offset 7168, length 294705, size 301873, clength 294705
 local size / mtime: 7168 / 1104290730
 remote size / mtime: 301873 / 1104290730
 Receiving INIT.2004-12-25.tgz (301873 bytes): 11%
 
 
