diff options
author | Wim <wim@42.be> | 2020-09-04 23:29:13 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-09-04 23:29:13 +0200 |
commit | 2f59abdda7a1072036ea1fdb4c859cccbb56efa6 (patch) | |
tree | e35393f23d12783ae92f0469085efc7dec953f82 /vendor/github.com/labstack/echo/v4/middleware | |
parent | 17747a5c8893fd47ba8eb61dd10477170640caf6 (diff) | |
download | matterbridge-msglm-2f59abdda7a1072036ea1fdb4c859cccbb56efa6.tar.gz matterbridge-msglm-2f59abdda7a1072036ea1fdb4c859cccbb56efa6.tar.bz2 matterbridge-msglm-2f59abdda7a1072036ea1fdb4c859cccbb56efa6.zip |
Update vendor (#1228)
Diffstat (limited to 'vendor/github.com/labstack/echo/v4/middleware')
4 files changed, 33 insertions, 2 deletions
diff --git a/vendor/github.com/labstack/echo/v4/middleware/compress.go b/vendor/github.com/labstack/echo/v4/middleware/compress.go index 89da16ef..dd97d983 100644 --- a/vendor/github.com/labstack/echo/v4/middleware/compress.go +++ b/vendor/github.com/labstack/echo/v4/middleware/compress.go @@ -119,3 +119,10 @@ func (w *gzipResponseWriter) Flush() { func (w *gzipResponseWriter) Hijack() (net.Conn, *bufio.ReadWriter, error) { return w.ResponseWriter.(http.Hijacker).Hijack() } + +func (w *gzipResponseWriter) Push(target string, opts *http.PushOptions) error { + if p, ok := w.ResponseWriter.(http.Pusher); ok { + return p.Push(target, opts) + } + return http.ErrNotSupported +} diff --git a/vendor/github.com/labstack/echo/v4/middleware/proxy.go b/vendor/github.com/labstack/echo/v4/middleware/proxy.go index 1da370db..a9b91f6c 100644 --- a/vendor/github.com/labstack/echo/v4/middleware/proxy.go +++ b/vendor/github.com/labstack/echo/v4/middleware/proxy.go @@ -45,6 +45,9 @@ type ( // Examples: If custom TLS certificates are required. Transport http.RoundTripper + // ModifyResponse defines function to modify response from ProxyTarget. + ModifyResponse func(*http.Response) error + rewriteRegex map[*regexp.Regexp]string } @@ -224,7 +227,7 @@ func ProxyWithConfig(config ProxyConfig) echo.MiddlewareFunc { // Rewrite for k, v := range config.rewriteRegex { - replacer := captureTokens(k, req.URL.Path) + replacer := captureTokens(k, echo.GetPath(req)) if replacer != nil { req.URL.Path = replacer.Replace(v) } 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 12b7568b..a4392781 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 @@ -20,5 +20,6 @@ func proxyHTTP(tgt *ProxyTarget, c echo.Context, config ProxyConfig) http.Handle c.Set("_error", echo.NewHTTPError(http.StatusBadGateway, fmt.Sprintf("remote %s unreachable, could not forward: %v", desc, err))) } proxy.Transport = config.Transport + proxy.ModifyResponse = config.ModifyResponse return proxy } diff --git a/vendor/github.com/labstack/echo/v4/middleware/recover.go b/vendor/github.com/labstack/echo/v4/middleware/recover.go index e87aaf32..0dbe740d 100644 --- a/vendor/github.com/labstack/echo/v4/middleware/recover.go +++ b/vendor/github.com/labstack/echo/v4/middleware/recover.go @@ -5,6 +5,7 @@ import ( "runtime" "github.com/labstack/echo/v4" + "github.com/labstack/gommon/log" ) type ( @@ -25,6 +26,10 @@ type ( // DisablePrintStack disables printing stack trace. // Optional. Default value as false. DisablePrintStack bool `yaml:"disable_print_stack"` + + // LogLevel is log level to printing stack trace. + // Optional. Default value 0 (Print). + LogLevel log.Lvl } ) @@ -35,6 +40,7 @@ var ( StackSize: 4 << 10, // 4 KB DisableStackAll: false, DisablePrintStack: false, + LogLevel: 0, } ) @@ -70,7 +76,21 @@ func RecoverWithConfig(config RecoverConfig) echo.MiddlewareFunc { stack := make([]byte, config.StackSize) length := runtime.Stack(stack, !config.DisableStackAll) if !config.DisablePrintStack { - c.Logger().Printf("[PANIC RECOVER] %v %s\n", err, stack[:length]) + msg := fmt.Sprintf("[PANIC RECOVER] %v %s\n", err, stack[:length]) + switch config.LogLevel { + case log.DEBUG: + c.Logger().Debug(msg) + case log.INFO: + c.Logger().Info(msg) + case log.WARN: + c.Logger().Warn(msg) + case log.ERROR: + c.Logger().Error(msg) + case log.OFF: + // None. + default: + c.Logger().Print(msg) + } } c.Error(err) } |