From owner-freebsd-questions@FreeBSD.ORG Fri Jul 17 22:52:48 2009 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E0F1E1065673 for ; Fri, 17 Jul 2009 22:52:48 +0000 (UTC) (envelope-from lists@jnielsen.net) Received: from ns1.jnielsen.net (ns1.jnielsen.net [69.55.238.237]) by mx1.freebsd.org (Postfix) with ESMTP id A9EE38FC24 for ; Fri, 17 Jul 2009 22:52:48 +0000 (UTC) (envelope-from lists@jnielsen.net) Received: from [172.17.2.19] (jn@stealth.jnielsen.net [74.218.226.254]) (authenticated bits=0) by ns1.jnielsen.net (8.12.9p2/8.12.9) with ESMTP id n6HMqlBc026730; Fri, 17 Jul 2009 18:52:47 -0400 (EDT) (envelope-from lists@jnielsen.net) From: John Nielsen To: freebsd-questions@freebsd.org Date: Fri, 17 Jul 2009 18:52:46 -0400 User-Agent: KMail/1.9.10 References: <20090717144049.C35992@cloud.ccsf.cc.ca.us> In-Reply-To: <20090717144049.C35992@cloud.ccsf.cc.ca.us> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200907171852.46730.lists@jnielsen.net> X-Virus-Scanned: ClamAV version 0.88.4, clamav-milter version 0.88.4 on ns1.jnielsen.net X-Virus-Status: Clean Cc: "Joe R. Jah" Subject: Re: OT: wget bug X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 17 Jul 2009 22:52:49 -0000 On Friday 17 July 2009 06:12:33 pm Joe R. Jah wrote: > I want to wget a site at regular intervals and only get the updated > pages, so I use the this wget command line: > > wget -b -m -nH http://host.domain/Directory/file.html > > It works fine on the first try, but it fails on subsequent tries with > the following error message: > > --8<-- > Connecting to host.domain ... connected. > HTTP request sent, awaiting response... 401 Unauthorized > Authorization failed. > --8<-- > > I can change directory from which to run wget every time, but that > defeats the purpose of downloading only the changed files. > > I googled "wget fails on second try" and found this small patch in a > Linux group that should supposedly fix the problem: > > --8<-- > --- wget-1.10.2/src/ftp.c.cwd 2006-12-03 13:23:08.801467652 +0100 > +++ wget-1.10.2/src/ftp.c 2006-12-03 20:30:24.641876672 +0100 > @@ -1172,7 +1172,7 @@ > len = 0; > err = getftp (u, &len, restval, con); > > - if (con->csock != -1) > + if (con->csock == -1) > con->st &= ~DONE_CWD; > else > con->st |= DONE_CWD; > --8<-- > > My wget is the latest version in the ports, 1.11.4. > > Any ideas or advise is greatly appreciated. I can't tell if your patch has already been applied upstream or if it's a "reverse" patch. The current distfile matches the "+++" version at line 1185. (normally the "+++" file is the new version but it's easy to get the order reversed if you're not used to running diff). You could always just try the patch. Something along the lines of this: cd /usr/ports/ftp/wget make clean make patch #extract the distfiles and apply FreeBSD patches cd work/wget-1.11.4/src vi ftp.c #or any editor you like ...go to line 1185 and change "==" to "!=" ...save and quit the editor cd /usr/ports/ftp/wget make make deinstall && make reinstall ... try your procedure again. If you don't like the results a "make clean" will erase your (modified) work directory and you can build the original version again. JN