]> Cypherpunks repositories - gostls13.git/commit
net/http: represent multi wildcards properly
authorJonathan Amsterdam <jba@google.com>
Sat, 27 Apr 2024 12:04:28 +0000 (08:04 -0400)
committerJonathan Amsterdam <jba@google.com>
Tue, 30 Apr 2024 15:43:24 +0000 (15:43 +0000)
commitcf058730293ac95ce0df40db8068219fe21cbb8a
treedcb98a8510d313c7bf3ef17f78cd80c558e75749
parent8509f6939ca87b99bbb4b70be086c455259618ad
net/http: represent multi wildcards properly

The routing tree used for matching ServeMux patterns used the
key "*" to hold a child node for a multi-segment wildcard.
The problem is that "*" is a valid path segment, which confused
the matching algorithm: it would fetch the multi wildcard child
when looking for the literal child for "*".

Eschew clever encodings. Use a separate field in the node to
represent the multi wildcard child.

Fixes #67067.

Change-Id: I300ca08b8628f5367626cf41979f6c238ed8c831
Reviewed-on: https://go-review.googlesource.com/c/go/+/582115
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Damien Neil <dneil@google.com>
src/net/http/request_test.go
src/net/http/routing_tree.go
src/net/http/routing_tree_test.go