mux icon indicating copy to clipboard operation
mux copied to clipboard

fix(mux.go): use cleaned path as URL.Path

Open with-shrey opened this issue 3 years ago • 8 comments

Fixes #673

Summary of Changes

  1. removed the redirection on path mismatch after cleanup
  2. used the cleaned up path for finding Path match

PS: Make sure your PR includes/updates tests! If you need help with this part, just ask! Will Update tests if the approach looks good

with-shrey avatar May 02 '22 21:05 with-shrey

The go http servers follows the same convention to redirect when the request path isn't clean. See here. I am unsure why ? It could be to protect against path traversal? I am might be worth investigating further before diverging from this behaviour.

chaudyg avatar May 18 '22 08:05 chaudyg

@chaudyg that could be true for the HTML website server.

But for REST Api based servers, this is not very intuitive as per my understanding

with-shrey avatar May 30 '22 10:05 with-shrey

@elithrar could use your advice here

with-shrey avatar May 30 '22 16:05 with-shrey

@elithrar could use your advice here

Needs positive & negative tests - for the mentioned issue and the delated code.

elithrar avatar May 30 '22 16:05 elithrar

@chaudyg that could be true for the HTML website server.

But for REST Api based servers, this is not very intuitive as per my understanding

There's no difference here: these are web servers. We can't break existing cases.

elithrar avatar May 30 '22 16:05 elithrar

I'm not discouraging anyone here. Changes proposed in the PR are not required and we can mark it as NA. Let me know what do you think?

Reason is because as @chaudyg mentioned already in comment net/http/server.go file we have implemented Redirect and same we're doing it in our mux. Removing Redirect from mux will not align with the original implementation.

amustaque97 avatar May 31 '22 10:05 amustaque97

Makes sense

On Tue, 31 May, 2022, 3:31 pm Mustaque Ahmed, @.***> wrote:

I'm not discouraging anyone here. Changes proposed in the PR are not required and we can mark it as NA. Let me know what do you think?

Reason is because as @chaudyg https://github.com/chaudyg mentioned already in comment https://github.com/gorilla/mux/pull/674#issuecomment-1129712157 net/http/server.go file we have implemented Redirect and same we're doing it in our mux. Removing Redirect from mux will not align with the original implementation.

— Reply to this email directly, view it on GitHub https://github.com/gorilla/mux/pull/674#issuecomment-1141930550, or unsubscribe https://github.com/notifications/unsubscribe-auth/AGAVQE4MQOWMLQDOVHV3FJDVMXPRLANCNFSM5U5DKZRA . You are receiving this because you authored the thread.Message ID: @.***>

with-shrey avatar May 31 '22 10:05 with-shrey

Makes sense On Tue, 31 May, 2022, 3:31 pm Mustaque Ahmed, @.> wrote: I'm not discouraging anyone here. Changes proposed in the PR are not required and we can mark it as NA. Let me know what do you think? Reason is because as @chaudyg https://github.com/chaudyg mentioned already in comment <#674 (comment)> net/http/server.go file we have implemented Redirect and same we're doing it in our mux. Removing Redirect from mux will not align with the original implementation. — Reply to this email directly, view it on GitHub <#674 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AGAVQE4MQOWMLQDOVHV3FJDVMXPRLANCNFSM5U5DKZRA . You are receiving this because you authored the thread.Message ID: @.>

@elithrar we can close the PR and its related issue.

amustaque97 avatar May 31 '22 20:05 amustaque97

superseded by https://github.com/gorilla/mux/issues/578

coreydaley avatar Aug 17 '23 01:08 coreydaley