aboutsummaryrefslogtreecommitdiff
path: root/src/net/http/export_test.go
diff options
context:
space:
mode:
authorJonathan Amsterdam <jba@google.com>2023-09-13 12:02:38 -0400
committerJonathan Amsterdam <jba@google.com>2023-09-13 20:07:22 +0000
commit545e4f38e0c177484ffa409c2fa1265423a5855f (patch)
tree4382de1fef7abcc2ff9079a747eb8dd3227df47f /src/net/http/export_test.go
parentf7f266c88598398dcf32b448bcea2100e1702630 (diff)
downloadgo-545e4f38e0c177484ffa409c2fa1265423a5855f.tar.xz
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 <jba@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Damien Neil <dneil@google.com>
Diffstat (limited to 'src/net/http/export_test.go')
0 files changed, 0 insertions, 0 deletions