diff options
| author | Jonathan Amsterdam <jba@google.com> | 2024-04-27 08:04:28 -0400 |
|---|---|---|
| committer | Jonathan Amsterdam <jba@google.com> | 2024-04-30 15:43:24 +0000 |
| commit | cf058730293ac95ce0df40db8068219fe21cbb8a (patch) | |
| tree | dcb98a8510d313c7bf3ef17f78cd80c558e75749 /src/net/http/request_test.go | |
| parent | 8509f6939ca87b99bbb4b70be086c455259618ad (diff) | |
| download | go-cf058730293ac95ce0df40db8068219fe21cbb8a.tar.xz | |
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>
Diffstat (limited to 'src/net/http/request_test.go')
| -rw-r--r-- | src/net/http/request_test.go | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/net/http/request_test.go b/src/net/http/request_test.go index 8c8116123c..a7deba46e3 100644 --- a/src/net/http/request_test.go +++ b/src/net/http/request_test.go @@ -1559,6 +1559,14 @@ func TestPathValue(t *testing.T) { "other": "there/is//more", }, }, + { + "/names/{name}/{other...}", + "/names/n/*", + map[string]string{ + "name": "n", + "other": "*", + }, + }, } { mux := NewServeMux() mux.HandleFunc(test.pattern, func(w ResponseWriter, r *Request) { |
