OT: wget bug
lists at jnielsen.net
Fri Jul 17 22:52:49 UTC 2009
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:
> Connecting to host.domain ... connected.
> HTTP request sent, awaiting response... 401 Unauthorized
> Authorization failed.
> 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:
> --- 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;
> con->st |= DONE_CWD;
> 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:
make patch #extract the distfiles and apply FreeBSD patches
vi ftp.c #or any editor you like
...go to line 1185 and change "==" to "!="
...save and quit the editor
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.
More information about the freebsd-questions