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

Not removing superfluous path elements like //// #40

Closed
kaibox-git opened this issue Aug 30, 2020 · 5 comments
Closed

Not removing superfluous path elements like //// #40

kaibox-git opened this issue Aug 30, 2020 · 5 comments

Comments

@kaibox-git
Copy link

kaibox-git commented Aug 30, 2020

I use code from: https://github.com/fasthttp/router/tree/v1.3.1/_examples/basic
All in default.
Checking "fix wrong cases and remove superfluous path elements (like ../ or //)" because my currect web-server doesn't do it.

http://localhost:8080/ works, it is normal
http://localhost:8080///// works too, not expected
http://localhost:8080////hello/////name works, does not redirect to correct http://localhost:8080/hello/name
But if I use capital letters:
http://localhost:8080////hELLO/////name
it correctly redirects to http://localhost:8080/hello/name removing reduntant slashes.

@kaibox-git kaibox-git changed the title Do not remove superfluous path elements like //// Not removing superfluous path elements like //// Aug 30, 2020
@savsgio
Copy link
Member

savsgio commented Sep 3, 2020

Hi @kaibox-git,

Well seen, I've just fixed it.

Thanks! 😉

@savsgio savsgio closed this as completed Sep 3, 2020
@savsgio
Copy link
Member

savsgio commented Sep 3, 2020

Take a look to the new release v1.3.2 🎉

@kaibox-git
Copy link
Author

It works, thank you!

@kaibox-git
Copy link
Author

But
r.GET("/", Index)
removing the last single slash. Typed and expected http://localhost/, but redirecting to http://localhost.

@savsgio
Copy link
Member

savsgio commented Sep 6, 2020

Hi @kaibox-git,

The trailing slash is removed by the browser, not by the router with a redirection, only when the path is /.

You could check it with a curl:

$ curl http://localhost:8080/ -v
*   Trying 127.0.0.1...
* TCP_NODELAY set
* Connected to localhost (127.0.0.1) port 8080 (#0)
> GET / HTTP/1.1
> Host: localhost:8080
> User-Agent: curl/7.64.1
> Accept: */*
> 
< HTTP/1.1 200 OK
< Server: fasthttp
< Date: Sun, 06 Sep 2020 14:57:50 GMT
< Content-Type: text/plain; charset=utf-8
< Content-Length: 9
< 
Welcome!
* Connection #0 to host localhost left intact
* Closing connection 0

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

No branches or pull requests

2 participants