Giovanni Tirloni
28095cf027
Do not return error on initial HEAD request
2018-06-13 20:30:19 -03:00
Giovanni Tirloni
b7ea0b44fc
HTTPDownloader - Fix invalid error handling
2018-06-13 17:42:27 -03:00
Giovanni Tirloni
413d13c411
Handle HTTP download errors
2018-04-26 18:59:30 -03:00
Ali Rizvi-Santiago
c17f827e1d
Split up DownloadableURL() into it's individual components: SupportedURL(), DownloadableURL(), and ValidatedURL(). Updated all instances of DownloadableURL() to point to ValidatedURL(). Reverted the tests that are based on un-supported protocols.
2018-01-16 13:37:32 -06:00
Ali Rizvi-Santiago
4a1fb0d262
Grrr...gofmt -w common/*.go
2018-01-16 13:37:31 -06:00
Ali Rizvi-Santiago
5d97b105a8
Removed implementation of the ftp protocol and the usage of cheggaaa's progress-bar as suggested by @SwampDragons. Replaced some of the old smoke-tests that were based on the ftp-protocol non-existing with a "non-existent://" protocol that's guaranteed to not exist.
2018-01-16 13:37:31 -06:00
Ali Rizvi-Santiago
5a3e98b529
Updated the testcases in common/download_test.go to pass a non-nil progress-bar due to the removal of a pointer type in commit ed2e341b7d7f49a063dd5018701b4ae548b8ec14 from yesterday.
2018-01-16 13:37:31 -06:00
Ali Rizvi-Santiago
ab4490b967
Consolidated progress bar's appearance into the GetDefaultProgressBar() function. Updated dependency for cheggaaa's progress-bar from the gopkg.in location to the better maintained one on github.com.
2018-01-16 13:37:31 -06:00
Ali Rizvi-Santiago
8c6efe336c
Added second argument for custom-formatted progress-bar to NewDownloadClient in common/download_test.go. This second parameter was added as a result of commit f0bd9018f3e318caafb1fe7d46e04c470e07c092 which lets you customize the progress-bar format.
2018-01-16 13:37:31 -06:00
Ali Rizvi-Santiago
69e5eec1ce
Consolidated the progress-bar's format into common/step_download.go. Removed DownloadClient's PercentProgress callback since cheggaaa's progress-bar already does that.
2018-01-16 13:37:31 -06:00
Ali Rizvi-Santiago
d85883582f
Changed a critical error to a non-critical one when dealing with the strange .CopyFile flag in common/download.go.
2018-01-16 13:37:31 -06:00
Ali Rizvi-Santiago
c978e27f0f
grr. removed an assignment that was dead in common/download.go.
2018-01-16 13:37:31 -06:00
Ali Rizvi-Santiago
5a4ce2165c
Modified common/download_test.go to not test the smb:// uri on platforms other than windows. Added an immediate platform error to SMBDownloader.Download as opposed to letting .toPath return it (which would have left the structure partially initialized).
2018-01-16 13:37:31 -06:00
Ali Rizvi-Santiago
b1ff14714b
go fmt
2018-01-16 13:37:31 -06:00
Ali Rizvi-Santiago
11ff4439a6
Moved the setting of HTTPDownloader's current progress to after the object actually gets instantiated. ;)
2018-01-16 13:37:31 -06:00
Ali Rizvi-Santiago
0fa6c3782e
Added a progressbar using gopkg.in/cheggaaa/pb.v1 as per #3578 for all the DownloadClients in common/download.go.
2018-01-16 13:37:31 -06:00
Ali Rizvi-Santiago
6170e24ecb
Refactored the code a bit to move the CopyFile hack out of DownloadClient and instead into each protocol.
...
config.go:
Removed all of the windows-specific net/url hackery since it's now handled mostly by download.go
Removed the replacement of '\' with '/' since url.Parse does it now.
Added knowledge of the other protocols implemented in download.go (ftp, smb)
Removed some modules that were unused in this commit.
download.go:
Moved the file-path conversions for the different protocols into their own internally callable functions.
Shuffled some of the functions around in case someone wants to implement the ability to resume.
Modified DownloadClient.Get to remove the CopyFile special case and trust the protocol implementations if a user doesn't want to copy the file.
Since all the protocols except for HTTPDownloader implement Cancel, added a Resume method as a placeholder for another developer to implement.
Added a few missing names from their function definitions.
Fixed the syntax in a few lines due to my suckage at go.
Adjusted the types for progress and total so that they support 64-bit sizes.
Removed the usage of the bufio library since it wasn't really being used.
2018-01-16 13:37:30 -06:00
Ali Rizvi-Santiago
60831801a7
Added the file, ftp, and smb downloaders to common/download.go
2018-01-16 13:36:18 -06:00
Ali Rizvi-Santiago
da9c94b345
Added some testcases for the various file uri transforms to download_test.go
...
Moved some of the code for normalizing a Windows file uri to a regular path into it's own function NormalizeWindowsURL
2018-01-16 13:36:18 -06:00
Ali Rizvi-Santiago
281dd1258a
Added proper support for downloading via a Windows UNC path or a relative uri.
...
Added proper support for validating a downloadableURL containing a UNC or relative uri.
Removed the workaround for an earlier Go issue that had remained dormant in common/download.go (issue #5927 ).
When building a .vmx file via the vmware-iso builder, transform the path to the correct os-formatted one (using filepath.FromSlash).
2018-01-16 13:36:17 -06:00
Megan Marsh
54bd057bb9
fix nasty edge case where we can't find guest additions on windows if they are on a different drive
2018-01-03 14:34:11 -08:00
Megan Marsh
3c20176dbb
runtime imported but not used
2017-11-16 11:12:23 -08:00
Megan Marsh
4fb8a27879
remove the actual offending code
2017-11-16 11:03:10 -08:00
Matthew Hooker
79287d7e47
simplify some code
2017-03-28 20:36:20 -07:00
Matthew Hooker
d920b3fbf4
run gofmt
2016-11-01 14:08:04 -07:00
Vasiliy Tolstov
4392f6df1c
common/download.go: allow to specify relative path for file scheme
...
Signed-off-by: Vasiliy Tolstov <v.tolstov@selfip.ru>
2016-07-06 13:03:39 +03:00
Chris Bednarski
1764238c0b
Added [DEBUG] prefix to log messages
2015-08-19 13:15:23 -07:00
Chris Bednarski
6e8c6a15ad
Implement fix, add comments so it's more apparent why we're doing special logic
2015-08-14 17:49:08 -07:00
Chris Bednarski
424ee65866
Added a log message when we use a local file instead of downloading one
2015-08-14 17:34:39 -07:00
Mitchell Hashimoto
0416939c08
common: always reset progress to 0 for downloads
2015-06-22 14:59:38 -07:00
Mitchell Hashimoto
117579808f
common: add the current progress to the total size
2015-06-22 14:58:27 -07:00
Mitchell Hashimoto
944b4bf46c
common: delete file if checksum fails
2015-06-22 12:17:29 -07:00
Mitchell Hashimoto
2f530534d2
common/download: resume test
2015-06-22 12:14:35 -07:00
Mitchell Hashimoto
aa7d3b7841
Merge pull request #2245 from vtolstov/iso
...
resume download after fail
2015-06-22 12:03:47 -07:00
Mitchell Hashimoto
897888fde3
common: fix potential panic case
2015-06-21 19:58:18 -07:00
Vasiliy Tolstov
d98de209cb
fallback to not ranged request if server lacks HEAD
...
Signed-off-by: Vasiliy Tolstov <v.tolstov@selfip.ru>
2015-06-16 01:04:48 +03:00
Vasiliy Tolstov
382fa01e6f
resume download after fail
...
close #2106
Signed-off-by: Vasiliy Tolstov <v.tolstov@selfip.ru>
2015-06-15 09:53:16 +03:00
Mark Rushakoff
9e5c0f6c6a
HTTPDownloader uses UserAgent from DownloadConfig
2014-01-09 08:41:34 -08:00
Mitchell Hashimoto
24db112b79
common: downloads can be HTTPS [GH-587]
2013-11-02 22:10:48 -05:00
Mitchell Hashimoto
01e998a81c
common: support SHA512 as checksum type [Gh-356]
2013-08-28 09:09:43 -07:00
Mitchell Hashimoto
8bbed8656a
common: use HTTP proxy if available from env [GH-252]
2013-08-18 12:34:36 -06:00
Mitchell Hashimoto
71664cb34e
common: return -1 download percent if download hasn't started [GH-288]
2013-08-14 11:15:47 -04:00
Mitchell Hashimoto
e2c667101c
common: style
2013-08-03 13:34:48 -07:00
Jason A. Beranek
3fa5fa396a
common/config,download: gofmt fixes
2013-08-02 16:06:06 -05:00
Jason A. Beranek
760f102c91
common/config,download: fix URL and relative Windows local file path issues [GH-235] [GH-239]
2013-08-02 15:59:19 -05:00
Mitchell Hashimoto
5b7d8fbc74
rename builder/common to common since it is generally useful
2013-08-01 12:11:54 -07:00