Closed
Description
Test code:
package main
import (
"github.com/labstack/echo"
)
func main() {
e := echo.New()
gr := e.Group("/acct/:a")
gr.Get("/hello", helloHandler)
e.Run(":4444")
}
func helloHandler(c *echo.Context) {
c.String(200, "Hello World!")
}
Failure demo:
$ go run main.go &
[1] 27082
$ curl -i http://localhost:4444/acct/abc
2015/04/28 21:22:57 http: panic serving [::1]:46035: runtime error: index out of range
goroutine 5 [running]:
net/http.func·011()
/big/usr-local/go/src/net/http/server.go:1130 +0xbb
github.com/labstack/echo.(*router).Find(0xc20800a750, 0xc20801e440, 0x3, 0xc20801e444, 0x9, 0xc2080403c0, 0x0, 0x0)
/home/src/github.com/labstack/echo/router.go:271 +0x43d
github.com/labstack/echo.(*Echo).ServeHTTP(0xc208066000, 0x7f50a9246010, 0xc2080441e0, 0xc208032410)
/home/src/github.com/labstack/echo/echo.go:294 +0xd0
net/http.serverHandler.ServeHTTP(0xc208042060, 0x7f50a9246010, 0xc2080441e0, 0xc208032410)
/big/usr-local/go/src/net/http/server.go:1703 +0x19a
net/http.(*conn).serve(0xc208044000)
/big/usr-local/go/src/net/http/server.go:1204 +0xb57
created by net/http.(*Server).Serve
/big/usr-local/go/src/net/http/server.go:1751 +0x35e
curl: (52) Empty reply from server
$ curl -i http://localhost:4444/acct/abc/
2015/04/28 21:23:05 http: panic serving [::1]:46036: runtime error: index out of range
goroutine 6 [running]:
net/http.func·011()
/big/usr-local/go/src/net/http/server.go:1130 +0xbb
github.com/labstack/echo.(*router).Find(0xc20800a750, 0xc20801e520, 0x3, 0xc20801e524, 0xa, 0xc208040500, 0x0, 0x0)
/home/src/github.com/labstack/echo/router.go:271 +0x43d
github.com/labstack/echo.(*Echo).ServeHTTP(0xc208066000, 0x7f50a9246010, 0xc208044320, 0xc2080325b0)
/home/src/github.com/labstack/echo/echo.go:294 +0xd0
net/http.serverHandler.ServeHTTP(0xc208042060, 0x7f50a9246010, 0xc208044320, 0xc2080325b0)
/big/usr-local/go/src/net/http/server.go:1703 +0x19a
net/http.(*conn).serve(0xc208044280)
/big/usr-local/go/src/net/http/server.go:1204 +0xb57
created by net/http.(*Server).Serve
/big/usr-local/go/src/net/http/server.go:1751 +0x35e
curl: (52) Empty reply from server