-
Notifications
You must be signed in to change notification settings - Fork 18k
net/http: infinite redirect on path variable followed by trailing slash #67657
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
The redirect loop was fixed by https://go.dev/cl/562557. I'm not sure what's going on with the 405 Method Not Allowed response after that CL. I'd expect a 404. The 405 is definitely wrong:
Sorry, we don't allow GET, only GET or HEAD. That's not right. |
Change https://go.dev/cl/594175 mentions this issue: |
Change https://go.dev/cl/594737 mentions this issue: |
This CL is similar to CL 562557, and it takes over CL 594175. While here, unrelatedly remove mapKeys function, use slices.Sorted(maps.Keys(ms)) to simplify code. Fixes golang#67657 Change-Id: Id8b99216f87a6dcfd6d5fa61407b515324c79112 Reviewed-on: https://go-review.googlesource.com/c/go/+/594737 LUCI-TryBot-Result: Go LUCI <[email protected]> Reviewed-by: Jonathan Amsterdam <[email protected]> Reviewed-by: Joedian Reid <[email protected]>
Go version
go version go1.22.3 darwin/arm64
Output of
go env
in your module/workspace:What did you do?
Run the following program:
What did you see happen?
Run the following curls (following redirects)
What did you expect to see?
The very last one should either 404 as it is not a registered command, or at the very least call the handler with an empty string for the
{user}
path value.Note that I built Go from source, and the latest build gives me a "MethodNotAllowed" instead of infinite redirects. It certainly is an improvement, but it feels like that's the wrong error code? The method is in fact allowed, but just not the path?
The text was updated successfully, but these errors were encountered: