github.com/shogo82148/std@v1.22.1-0.20240327122250-4e474527810c/net/http/routing_tree.go (about) 1 // Copyright 2023 The Go Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style 3 // license that can be found in the LICENSE file. 4 5 // This file implements a decision tree for fast matching of requests to 6 // patterns. 7 // 8 // The root of the tree branches on the host of the request. 9 // The next level branches on the method. 10 // The remaining levels branch on consecutive segments of the path. 11 // 12 // The "more specific wins" precedence rule can result in backtracking. 13 // For example, given the patterns 14 // /a/b/z 15 // /a/{x}/c 16 // we will first try to match the path "/a/b/c" with /a/b/z, and 17 // when that fails we will try against /a/{x}/c. 18 19 package http