[linux] Re: Bij wget -c krijg ik error 416

Paul Slootman paul+nospam op wurtel.net
Ma mei 24 12:49:37 CEST 2010


On Fri 21 May 2010, Cecil Westerhof wrote:

> Ik gebruik wget -c om een document alleen op te halen wanneer het
> veranderd is. Als het document niet veranderd is krijg ik echter:
>     416 Requested Range Not Satisfiable
> 
> Wat gaat er hier fout?

Je gebruik van -c is fout.

-c is voor "continue". Dus als de vorige download is afgebroken na X
bytes, dan vraagt wget aan de webserver om de bytes vanaf X+1 tot het
eind te serveren. Als de file dus wel gewoon compleet binnen is, dan
zegt de webserver "er zijn helemaal geen bytes X+1 en verder", oftewel
precies wat de foutmelding zegt.

Jouw -c gebruik zou dus fout kunnen gaan als de file wel langer geworden
is, maar ook in het begin bytes anders geworden zijn. Zoals de manpage
ook zegt:

    On the other side of the coin, while using `-c', any file that's
    bigger on the server than locally will be considered an incomplete
    download and only `(length(remote) - length(local))' bytes will be
    downloaded and tacked onto the end of the local file.  This behavior
    can be desirable in certain cases--for instance, you can use `wget
    -c' to download just the new portion that's been appended to a data
    collection or log file.

    However, if the file is bigger on the server because it's been
    _changed_, as opposed to just _appended_ to, you'll end up with a
    garbled file.  Wget has no way of verifying that the local file is
    really a valid prefix of the remote file.  You need to be especially
    careful of this when using `-c' in conjunction with `-r', since
    every file will be considered as an "incomplete download" candidate.

Wat jij wilt is meer dit:

    When running Wget with `-N', with or without `-r' or `-p', the
    decision as to whether or not to download a newer copy of a file
    depends on the local and remote timestamp and size of the file (see
    "Time-Stamping").

Oftewel, gewoon de manpage goed lezen.


Paul



More information about the Linux mailing list