Re: [go-nuts] Re: url.ParseRequestURI validation of path

2025-05-04 Thread 'Alexander Ertli' via golang-nuts
EscapedPath() sometimes re-generates the escaped path, especially if the original path contains unencoded characters like Ñ or literal spaces. When it does this reconstruction, it works from the decoded path segments, which is likely why the original %2F encoding was lost in your example. This seem

[go-nuts] Unexpected 301 Redirect with http.StripPrefix + nested http.ServeMux in Go 1.24.1?

2025-04-04 Thread 'Alexander Ertli' via golang-nuts
Hello, I'm encountering unexpected behavior with net/http routing in Go 1.24.1 (amd64, ubuntu linux) when using http.StripPrefix to delegate to a nested http.ServeMux which uses the Go 1.22+ METHOD /path routing syntax. Instead of the nested ServeMux executing its registered handlers for the

Re: [go-nuts] Re: url.ParseRequestURI validation of path

2025-05-15 Thread 'Alexander Ertli' via golang-nuts
Hi Diego, You're absolutely right to point out the flaw in my snippet, thanks for catching that. That said, my goal wasn't to provide a complete solution, but rather a minimal example to highlight the core issue. Judging from your ability to spot the edge case, I’m sure you’re more than capable of

Re: [go-nuts] Spooky: http.Error(w, [text], [statusCode]) responds the code without the text

2025-05-26 Thread 'Alexander Ertli' via golang-nuts
Hey! I saw your post and to me it looks like the issue is in your JavaScript code. You're using response.statusText, which is *not* the response body. It's expected to see exactly what you're observing, because statusText just gives you the standard reason phrase for the status code (like "Forbidd

Re: [go-nuts] The motivation for the use of length in copy function instead of the capacity

2025-05-28 Thread 'Alexander Ertli' via golang-nuts
Hi, I think the core reasoning is that once a slice is created, its capacity is fixed – you can’t really change it without allocating a new backing array and copying elements over. You *can* reduce the length easily (s = s[:n]), but not the capacity. ```a := make([]int, 0, 10) b := make([]int, 10