Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
net/http: ServeMux handles extended patterns
Modify ServeMux to handle patterns with methods and wildcards. Remove the map and list of patterns. Instead patterns are registered and matched using a routing tree. We also reorganize the code around "trailing-slash redirection," the feature whereby a trailing slash is added to a path if it doesn't match an existing one. The existing code checked the map of paths twice, but searching the tree twice would be needlessly expensive. The rewrite searches the tree once, and then again only if a trailing-slash redirection is possible. There are a few omitted features in this CL, indicated with TODOs. Change-Id: Ifaef59f6c8c7b7131dc4a5d0f101cc22887bdc74 Reviewed-on: https://go-review.googlesource.com/c/go/+/528039 Run-TryBot: Jonathan Amsterdam <[email protected]> TryBot-Result: Gopher Robot <[email protected]> Reviewed-by: Damien Neil <[email protected]>
- Loading branch information