From fdf1164aee36d60b34ca82c07fe02b68e972f53a Mon Sep 17 00:00:00 2001 From: Torsten Juergeleit Date: Wed, 31 May 2017 16:34:05 +0200 Subject: PLT-5705 Created a single source of http.Client creation logic with internet proxy support, reasonable timeouts and optional insecure connections (#6503) --- app/command.go | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) (limited to 'app/command.go') diff --git a/app/command.go b/app/command.go index 2af934710..bfb97ae0c 100644 --- a/app/command.go +++ b/app/command.go @@ -4,7 +4,6 @@ package app import ( - "crypto/tls" "fmt" "io/ioutil" "net/http" @@ -204,18 +203,13 @@ func ExecuteCommand(args *model.CommandArgs) (*model.CommandResponse, *model.App method = "GET" } - tr := &http.Transport{ - TLSClientConfig: &tls.Config{InsecureSkipVerify: *utils.Cfg.ServiceSettings.EnableInsecureOutgoingConnections}, - } - client := &http.Client{Transport: tr} - req, _ := http.NewRequest(method, cmd.URL, strings.NewReader(p.Encode())) req.Header.Set("Accept", "application/json") if cmd.Method == model.COMMAND_METHOD_POST { req.Header.Set("Content-Type", "application/x-www-form-urlencoded") } - if resp, err := client.Do(req); err != nil { + if resp, err := utils.HttpClient().Do(req); err != nil { return nil, model.NewAppError("command", "api.command.execute_command.failed.app_error", map[string]interface{}{"Trigger": trigger}, err.Error(), http.StatusInternalServerError) } else { if resp.StatusCode == http.StatusOK { -- cgit v1.2.3-1-g7c22