From 7263e50e10ce1a998c4ac33b0c37025a762f0127 Mon Sep 17 00:00:00 2001 From: Vishal Rana Date: Sat, 12 Mar 2016 03:54:54 -0800 Subject: [PATCH] Fixed #389 --- engine/fasthttp/server.go | 8 ++++---- engine/standard/server.go | 8 ++++---- middleware/auth.go | 4 ++-- website/content/index.md | 2 +- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/engine/fasthttp/server.go b/engine/fasthttp/server.go index 0eb9b0c8..9c62fbba 100644 --- a/engine/fasthttp/server.go +++ b/engine/fasthttp/server.go @@ -13,7 +13,7 @@ import ( type ( Server struct { - config *engine.Config + config engine.Config handler engine.Handler logger *log.Logger pool *Pool @@ -29,12 +29,12 @@ type ( ) func New(addr string) *Server { - c := &engine.Config{Address: addr} + c := engine.Config{Address: addr} return NewFromConfig(c) } func NewFromTLS(addr, certfile, keyfile string) *Server { - c := &engine.Config{ + c := engine.Config{ Address: addr, TLSCertfile: certfile, TLSKeyfile: keyfile, @@ -42,7 +42,7 @@ func NewFromTLS(addr, certfile, keyfile string) *Server { return NewFromConfig(c) } -func NewFromConfig(c *engine.Config) (s *Server) { +func NewFromConfig(c engine.Config) (s *Server) { s = &Server{ config: c, pool: &Pool{ diff --git a/engine/standard/server.go b/engine/standard/server.go index d4b744b6..051e5a09 100644 --- a/engine/standard/server.go +++ b/engine/standard/server.go @@ -12,7 +12,7 @@ import ( type ( Server struct { *http.Server - config *engine.Config + config engine.Config handler engine.Handler logger *log.Logger pool *Pool @@ -27,12 +27,12 @@ type ( ) func New(addr string) *Server { - c := &engine.Config{Address: addr} + c := engine.Config{Address: addr} return NewFromConfig(c) } func NewFromTLS(addr, certfile, keyfile string) *Server { - c := &engine.Config{ + c := engine.Config{ Address: addr, TLSCertfile: certfile, TLSKeyfile: keyfile, @@ -40,7 +40,7 @@ func NewFromTLS(addr, certfile, keyfile string) *Server { return NewFromConfig(c) } -func NewFromConfig(c *engine.Config) (s *Server) { +func NewFromConfig(c engine.Config) (s *Server) { s = &Server{ Server: new(http.Server), config: c, diff --git a/middleware/auth.go b/middleware/auth.go index fca6cc7f..403e6fe2 100644 --- a/middleware/auth.go +++ b/middleware/auth.go @@ -22,7 +22,7 @@ const ( // // For valid credentials it calls the next handler. // For invalid credentials, it sends "401 - Unauthorized" response. -func BasicAuth(fn BasicAuthFunc, options ...*BasicAuthOptions) echo.MiddlewareFunc { +func BasicAuth(fn BasicAuthFunc, options ...BasicAuthOptions) echo.MiddlewareFunc { return func(next echo.Handler) echo.Handler { return echo.HandlerFunc(func(c echo.Context) error { auth := c.Request().Header().Get(echo.Authorization) @@ -36,7 +36,7 @@ func BasicAuth(fn BasicAuthFunc, options ...*BasicAuthOptions) echo.MiddlewareFu if cred[i] == ':' { // Verify credentials if fn(cred[:i], cred[i+1:]) { - return nil + return next.Handle(c) } } } diff --git a/website/content/index.md b/website/content/index.md index bd6f6106..247062cc 100644 --- a/website/content/index.md +++ b/website/content/index.md @@ -79,7 +79,7 @@ Hello, World! on the page. ### Next? - Browse [recipes](/recipes/hello-world) -- Head over to [guide](/guide/installation") +- Head over to [guide](/guide/installation) ## Contribute