@@ -338,13 +338,20 @@ func NewExternalClient(sshBinaryPath, user, host string, port int, auth *Auth) (
338338 client := & ExternalClient {
339339 BinaryPath : sshBinaryPath ,
340340 }
341-
342341 var args []string
343- envVar := util .GetProxyURL ()
342+ // http proxy should be used for the SSH connection
343+ proxy , err := util .GetProxyURL ("http://" + host )
344+ if err != nil {
345+ return nil , fmt .Errorf ("failed to get the http proxy for the exernal client: %v" , err )
346+ }
347+ proxy_url := ""
348+ if proxy != nil {
349+ proxy_url = proxy .Host
350+ }
344351 ncBinaryPath , _ := exec .LookPath ("nc" )
345- log .Debugf ("envVar : %s; ncBinaryPath: %s" , envVar , ncBinaryPath )
346- if envVar != "" && ncBinaryPath != "" {
347- args = append (baseSSHArgs , "-o" , fmt .Sprintf (SSHProxyArg , ncBinaryPath , envVar ), fmt .Sprintf ("%s@%s" , user , host ))
352+ log .Debugf ("proxy_url : %s; ncBinaryPath: %s" , proxy_url , ncBinaryPath )
353+ if proxy_url != "" && ncBinaryPath != "" {
354+ args = append (baseSSHArgs , "-o" , fmt .Sprintf (SSHProxyArg , ncBinaryPath , proxy_url ), fmt .Sprintf ("%s@%s" , user , host ))
348355 } else {
349356 args = append (baseSSHArgs , fmt .Sprintf ("%s@%s" , user , host ))
350357 }
0 commit comments