Wed 15 Jun 2016 03:06:05 PM UTC, original submission:
If the connection is interrupted during download, wget normally tries to continue the download from the same place where it left off. This only works if the server supports resumed downloads, otherwise, download restarts from the beginning. However, sometimes wget would restart the download even when the server does support resumption. Testing shows that this happens if a network error occurs before wget receives HTTP response from the server, a situation which is quite common on poor networks.
For testing, I created a web server which would behave as follows:
- On the first request, it will send a response with `Content-Length: 1000` and 500 bytes of data, then wait.
- On all other requests, it will just wait without sending any data.
Using wget to download from such server produces this:
As you may see, only the second request includes `Range` header. Starting from the third request, `Range` header is not included, so the download would not be resumed at this point. In practice, this means that a big download would suddenly restart because the network was down for some time, which is undesirable.
I attached a test program to reproduce the issue. It listens on [::1]:8888 and acts as a web server. You need to restart it before every test.
Related bugs:
- #31653: a fix for that bug is probably what introduced this bug. Read the discussion there.
- #48123: a bug similar to this one, but there it is not clear that the server supports resumed downloads.
|