Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
P
packer
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kristopher Ruzic
packer
Commits
5ba5834a
Commit
5ba5834a
authored
Jul 07, 2013
by
Mitchell Hashimoto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
builder/common: Error on non-200 download responses [GH-141]
parent
83d073f4
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
0 deletions
+16
-0
CHANGELOG.md
CHANGELOG.md
+2
-0
builder/common/download.go
builder/common/download.go
+14
-0
No files found.
CHANGELOG.md
View file @
5ba5834a
...
...
@@ -14,6 +14,8 @@ IMPROVEMENTS:
BUG FIXES:
*
core: Non-200 response codes on downloads now show proper errors.
[GH-141]
*
vagrant: The
`BuildName`
template propery works properly in
the output path.
*
vagrant: Properly configure the provider-specific post-processors so
...
...
builder/common/download.go
View file @
5ba5834a
...
...
@@ -107,6 +107,9 @@ func (d *DownloadClient) Get() (string, error) {
log
.
Printf
(
"Downloading: %s"
,
url
.
String
())
err
=
d
.
downloader
.
Download
(
f
,
url
)
if
err
!=
nil
{
return
""
,
err
}
}
if
d
.
config
.
Hash
!=
nil
{
...
...
@@ -160,11 +163,22 @@ func (*HTTPDownloader) Cancel() {
}
func
(
d
*
HTTPDownloader
)
Download
(
dst
io
.
Writer
,
src
*
url
.
URL
)
error
{
log
.
Printf
(
"Starting download: %s"
,
src
.
String
())
resp
,
err
:=
http
.
Get
(
src
.
String
())
if
err
!=
nil
{
return
err
}
if
resp
.
StatusCode
!=
200
{
log
.
Printf
(
"Non-200 status code: %d. Getting error body."
,
resp
.
StatusCode
)
errorBody
:=
new
(
bytes
.
Buffer
)
io
.
Copy
(
errorBody
,
resp
.
Body
)
return
fmt
.
Errorf
(
"HTTP error '%d'! Remote side responded:
\n
%s"
,
resp
.
StatusCode
,
errorBody
.
String
())
}
d
.
progress
=
0
d
.
total
=
uint
(
resp
.
ContentLength
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment