Skip to content
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

Multiple slashes in path is not working #1644

Closed
QianChenglong opened this issue Nov 14, 2018 · 10 comments · Fixed by #1817
Closed

Multiple slashes in path is not working #1644

QianChenglong opened this issue Nov 14, 2018 · 10 comments · Fixed by #1817

Comments

@QianChenglong
Copy link

QianChenglong commented Nov 14, 2018

Description

Multiple slashes in path can't be routed!

In stdlib http, the ServeMux use cleanPath on path.

image

Screenshots

image

@thinkerou
Copy link
Member

@QianChenglong please post demo example and curl command, thanks!

@QianChenglong
Copy link
Author

@thinkerou
image
image

@QianChenglong
Copy link
Author

image

In my project, I just cleanPath on it. I'm not sure it's ok on other situation.

@thinkerou
Copy link
Member

@QianChenglong I want to know which scenario use //?

@QianChenglong
Copy link
Author

The user of API is others, can not be controlled.

@thinkerou
Copy link
Member

Now gin can set gin.RedirectFixedPath, and then it will return 301 which can't execute it.

@QianChenglong
Copy link
Author

I had tried that feature.It rediect by 307.But which i need and other router supports direct process.

@thinkerou
Copy link
Member

ref: #789

@QianChenglong
Copy link
Author

QianChenglong commented Nov 14, 2018

  1. Redirect depends caller follow which can't be promised.
  2. Redirect means more round trip time which is not reasonable.
  3. In my suitation, the URL is same meaning, so should be processed directly!

@dmarkham
Copy link
Contributor

This will also cause Path Parameters to get missed.
GET : http://localhost:8180//49cEhsh5Hg
router.GET("/:myparam", someHandler())
myparam in this case will be empty. 👎

dmarkham added a commit to dmarkham/gin that referenced this issue Mar 18, 2019
This will reduce the number of times we have todo a redirect.
and allow multiple slashes in path to be routed!
fixes gin-gonic#1644
thinkerou pushed a commit that referenced this issue May 7, 2019
This will reduce the number of times we have todo a redirect.
and allow multiple slashes in path to be routed!
fixes #1644
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants