diff options
author | Wim <wim@42.be> | 2020-01-09 21:02:56 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-01-09 21:02:56 +0100 |
commit | 0f708daf2d14dcca261ef98cc698a1b1f2a6aa74 (patch) | |
tree | 022eee21366d6a9a00feaeff918972d9e72632c2 /vendor/github.com/labstack/echo/v4/middleware | |
parent | b9354de8fd5e424ac2f246fff1a03b27e8094fd8 (diff) | |
download | matterbridge-msglm-0f708daf2d14dcca261ef98cc698a1b1f2a6aa74.tar.gz matterbridge-msglm-0f708daf2d14dcca261ef98cc698a1b1f2a6aa74.tar.bz2 matterbridge-msglm-0f708daf2d14dcca261ef98cc698a1b1f2a6aa74.zip |
Update dependencies (#975)
Diffstat (limited to 'vendor/github.com/labstack/echo/v4/middleware')
3 files changed, 9 insertions, 9 deletions
diff --git a/vendor/github.com/labstack/echo/v4/middleware/body_dump.go b/vendor/github.com/labstack/echo/v4/middleware/body_dump.go index 418d279d..ebd0d0ab 100644 --- a/vendor/github.com/labstack/echo/v4/middleware/body_dump.go +++ b/vendor/github.com/labstack/echo/v4/middleware/body_dump.go @@ -40,7 +40,7 @@ var ( // BodyDump returns a BodyDump middleware. // -// BodyLimit middleware captures the request and response payload and calls the +// BodyDump middleware captures the request and response payload and calls the // registered handler. func BodyDump(handler BodyDumpHandler) echo.MiddlewareFunc { c := DefaultBodyDumpConfig diff --git a/vendor/github.com/labstack/echo/v4/middleware/proxy.go b/vendor/github.com/labstack/echo/v4/middleware/proxy.go index 532346d5..ef5602bd 100644 --- a/vendor/github.com/labstack/echo/v4/middleware/proxy.go +++ b/vendor/github.com/labstack/echo/v4/middleware/proxy.go @@ -92,15 +92,14 @@ func proxyRaw(t *ProxyTarget, c echo.Context) http.Handler { return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { in, _, err := c.Response().Hijack() if err != nil { - c.Error(fmt.Errorf("proxy raw, hijack error=%v, url=%s", t.URL, err)) + c.Set("_error", fmt.Sprintf("proxy raw, hijack error=%v, url=%s", t.URL, err)) return } defer in.Close() out, err := net.Dial("tcp", t.URL.Host) if err != nil { - he := echo.NewHTTPError(http.StatusBadGateway, fmt.Sprintf("proxy raw, dial error=%v, url=%s", t.URL, err)) - c.Error(he) + c.Set("_error", echo.NewHTTPError(http.StatusBadGateway, fmt.Sprintf("proxy raw, dial error=%v, url=%s", t.URL, err))) return } defer out.Close() @@ -108,8 +107,7 @@ func proxyRaw(t *ProxyTarget, c echo.Context) http.Handler { // Write header err = r.Write(out) if err != nil { - he := echo.NewHTTPError(http.StatusBadGateway, fmt.Sprintf("proxy raw, request header copy error=%v, url=%s", t.URL, err)) - c.Error(he) + c.Set("_error", echo.NewHTTPError(http.StatusBadGateway, fmt.Sprintf("proxy raw, request header copy error=%v, url=%s", t.URL, err))) return } @@ -123,7 +121,7 @@ func proxyRaw(t *ProxyTarget, c echo.Context) http.Handler { go cp(in, out) err = <-errCh if err != nil && err != io.EOF { - c.Logger().Errorf("proxy raw, copy body error=%v, url=%s", t.URL, err) + c.Set("_error", fmt.Errorf("proxy raw, copy body error=%v, url=%s", t.URL, err)) } }) } @@ -251,6 +249,9 @@ func ProxyWithConfig(config ProxyConfig) echo.MiddlewareFunc { default: proxyHTTP(tgt, c, config).ServeHTTP(res, req) } + if e, ok := c.Get("_error").(error); ok { + err = e + } return } diff --git a/vendor/github.com/labstack/echo/v4/middleware/proxy_1_11.go b/vendor/github.com/labstack/echo/v4/middleware/proxy_1_11.go index 7784f9c6..12b7568b 100644 --- a/vendor/github.com/labstack/echo/v4/middleware/proxy_1_11.go +++ b/vendor/github.com/labstack/echo/v4/middleware/proxy_1_11.go @@ -17,8 +17,7 @@ func proxyHTTP(tgt *ProxyTarget, c echo.Context, config ProxyConfig) http.Handle if tgt.Name != "" { desc = fmt.Sprintf("%s(%s)", tgt.Name, tgt.URL.String()) } - c.Logger().Errorf("remote %s unreachable, could not forward: %v", desc, err) - c.Error(echo.NewHTTPError(http.StatusServiceUnavailable)) + c.Set("_error", echo.NewHTTPError(http.StatusBadGateway, fmt.Sprintf("remote %s unreachable, could not forward: %v", desc, err))) } proxy.Transport = config.Transport return proxy |