Skip to content

Commit

Permalink
Get version after checking response is complete
Browse files Browse the repository at this point in the history
  • Loading branch information
joereuss12 committed Feb 2, 2024
1 parent 6ae5cea commit e025ab0
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions client/handle_http.go
Original file line number Diff line number Diff line change
Expand Up @@ -570,7 +570,6 @@ func DownloadHTTP(transfer TransferDetails, dest string, token string, payload *
log.Debugln("Starting the HTTP transfer...")
filename := path.Base(dest)
resp := client.Do(req)
serverVersion := resp.HTTPResponse.Header.Get("Server")
downloadStart := time.Now()
// Check the error real quick
if resp.IsComplete() {
Expand All @@ -579,9 +578,10 @@ func DownloadHTTP(transfer TransferDetails, dest string, token string, payload *
err = fmt.Errorf("Local copy of file is larger than remote copy %w", grab.ErrBadLength)
}
log.Errorln("Failed to download:", err)
return 0, 0, serverVersion, &ConnectionSetupError{Err: err}
return 0, 0, "", &ConnectionSetupError{Err: err}
}
}
serverVersion := resp.HTTPResponse.Header.Get("Server")

// Size of the download
contentLength := resp.Size()
Expand Down Expand Up @@ -736,7 +736,7 @@ Loop:
if errors.Is(err, syscall.ECONNREFUSED) ||
errors.Is(err, syscall.ECONNRESET) ||
errors.Is(err, syscall.ECONNABORTED) {
return 0, 0, serverVersion, &ConnectionSetupError{URL: resp.Request.URL().String()}
return 0, 0, "", &ConnectionSetupError{URL: resp.Request.URL().String()}
}
log.Debugln("Got error from HTTP download", err)
return 0, 0, serverVersion, err
Expand Down

0 comments on commit e025ab0

Please sign in to comment.