1
0
mirror of https://github.com/kataras/iris.git synced 2026-03-10 18:35:57 +00:00

nothing special here

This commit is contained in:
Gerasimos Maropoulos
2016-09-18 21:57:15 +03:00
parent 2cb0d9981d
commit d00bd8e595
2 changed files with 17 additions and 16 deletions

10
http.go
View File

@@ -1335,8 +1335,9 @@ type (
}
serveMux struct {
tree *muxTree
lookups []*route
tree *muxTree
lookups []*route
maxParameters uint8
onLookup func(Route)
@@ -1454,6 +1455,7 @@ func (mux *serveMux) build() (func(reqCtx *fasthttp.RequestCtx) string, func([]b
if tree == nil {
//first time we register a route to this method with this domain
tree = &muxTree{method: r.method, subdomain: r.subdomain, entry: &muxEntry{}, next: nil}
if mux.tree == nil {
// it's the first entry
mux.tree = tree
@@ -1474,6 +1476,10 @@ func (mux *serveMux) build() (func(reqCtx *fasthttp.RequestCtx) string, func([]b
if err := tree.entry.add(r.path, r.middleware); err != nil {
mux.logger.Panic(err.Error())
}
if mp := tree.entry.paramsLen; mp > mux.maxParameters {
mux.maxParameters = mp
}
}
// optimize this once once, we could do that: context.RequestPath(mux.escapePath), but we lose some nanoseconds on if :)