From e0ef592544eb41e8a4957b86d1ac5508404e403c Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Thu, 19 Nov 2015 16:14:13 -0800 Subject: [PATCH] core: retry if server doesn't support byte ranges on download [GH-4479] --- CHANGELOG.md | 2 ++ lib/vagrant/util/downloader.rb | 5 ++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 36d37c1032c..9c9cb718722 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -63,6 +63,8 @@ BUG FIXES: - core: don't check for metadata if the download URL is not HTTP [GH-6540] - core: don't make custom dotfile path if there is no Vagrantfile [GH-6542] - core: more robust check for admin privs on Windows [GH-5616] + - core: properly detect when HTTP server doesn't support byte ranges and + retry from scratch [GH-4479] - commands/box: removing all versions and providers of a box will properly clean all directories in `~/.vagrant.d/boxes` [GH-3570] - commands/rdp: prefer `xfreerdp` if it is available on Linux [GH-6475] diff --git a/lib/vagrant/util/downloader.rb b/lib/vagrant/util/downloader.rb index edaf99e85e3..03e623897a9 100644 --- a/lib/vagrant/util/downloader.rb +++ b/lib/vagrant/util/downloader.rb @@ -138,11 +138,14 @@ def download! # If we already retried, raise it. raise if retried + @logger.error("Exit code: #{e.extra_data[:code]}") + # If its any error other than 33, it is an error. - raise if e.extra_data[:exit_code].to_i != 33 + raise if e.extra_data[:code].to_i != 33 # Exit code 33 means that the server doesn't support ranges. # In this case, try again without resume. + @logger.error("Error is server doesn't support byte ranges. Retrying from scratch.") @continue = false retried = true retry