From ec76de3cef26469b4a109096561b3e73072f64ec Mon Sep 17 00:00:00 2001 From: Darren Shepherd Date: Wed, 30 Nov 2016 14:28:38 -0700 Subject: [PATCH] Fix events with auth --- trash.conf | 2 +- vendor/github.com/rancher/go-rancher/v2/common.go | 13 ++++++++++++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/trash.conf b/trash.conf index ac4642b52..109b38325 100644 --- a/trash.conf +++ b/trash.conf @@ -15,7 +15,7 @@ github.com/mitchellh/mapstructure ca63d7c062ee3c9f34db231e352b60012b4fd0c1 github.com/opencontainers/runc cc29e3dded8e27ba8f65738f40d251c885030a28 github.com/patrickmn/go-cache 1881a9bccb818787f68c52bfba648c6cf34c34fa github.com/pkg/errors 1d2e60385a13aaa66134984235061c2f9302520e -github.com/rancher/go-rancher af955cd2925739b199df4077fafaddfaa4834a2f +github.com/rancher/go-rancher f4560b58215d7eefc74f867a450ded571b731609 github.com/rancher/rancher-catalog-service a3a8b500adceb82b3a0387b2c7b06a60e7eeee9a github.com/rancher/rancher-compose v0.11.0 github.com/rancher/rancher-docker-api-proxy 461b5e7022698283030495cf5693680699ce9c28 diff --git a/vendor/github.com/rancher/go-rancher/v2/common.go b/vendor/github.com/rancher/go-rancher/v2/common.go index 0061bf8a7..c4eeb6f29 100644 --- a/vendor/github.com/rancher/go-rancher/v2/common.go +++ b/vendor/github.com/rancher/go-rancher/v2/common.go @@ -2,6 +2,7 @@ package client import ( "bytes" + "encoding/base64" "encoding/json" "fmt" "io" @@ -251,7 +252,17 @@ func (rancherClient *RancherBaseClientImpl) doDelete(url string) error { } func (rancherClient *RancherBaseClientImpl) Websocket(url string, headers map[string][]string) (*websocket.Conn, *http.Response, error) { - return dialer.Dial(url, http.Header(headers)) + httpHeaders := http.Header{} + for k, v := range httpHeaders { + httpHeaders[k] = v + } + + if rancherClient.Opts != nil { + s := rancherClient.Opts.AccessKey + ":" + rancherClient.Opts.SecretKey + httpHeaders.Add("Authorization", "Basic "+base64.StdEncoding.EncodeToString([]byte(s))) + } + + return dialer.Dial(url, http.Header(httpHeaders)) } func (rancherClient *RancherBaseClientImpl) doGet(url string, opts *ListOpts, respObject interface{}) error {