Skip to content

how to prevent unescape path in v3.0.3? #766

Closed

Description

@voids

Description

"%2F" will be convert to slashes before routing.

the closed issues below don't make any sense in v3.0.3.
#587
#561

Activity

  1. vishr commented on Dec 8, 2016

    @vishr
    Member

    We have gone back and forth in these issues and I am not sure how it should be addressed. Appreciate everyone's opinion.

    @cdfox @yaa110 @Anon-Penguin @ansel1 @luca-moser @CaptainCodeman

  2. ansel1 commented on Dec 8, 2016

    @ansel1

    In #561, I commented that we had added middleware (early in the chain, but after routing) which used QueryUnescape on all the path params.

    That turned out to be wrong to, because the rules for query escaping are not the same as for path escaping. golang 1.8 has acknowledged this by adding new PathEscape and PathUnescape functions.

    I think the cleanest solution is:

    1. do not unescape the URI. Let the router see the raw, escaped incoming URI, and match against that
    2. When constructing the Context and populating it with the path params, unescape the path params. So in my handlers/middleware, when I call c.Param(), I get back a value which has already been unescaped
  3. vishr commented on Dec 8, 2016

    @vishr
    Member

    do not unescape the URI. Let the router see the raw, escaped incoming URI, and match against that

    Agree

    When constructing the Context and populating it with the path params, unescape the path params. So in my handlers/middleware, when I call c.Param(), I get back a value which has already been unescaped

    can this be done outside the framework? Not in favour of extra calculation inside.

  4. ansel1 commented on Dec 8, 2016

    @ansel1
  5. vishr commented on Dec 8, 2016

    @vishr
    Member

    For now, it's even with v2.

  6. added a commit that references this issue on Dec 8, 2016
    95e1bd4
  7. mathvav commented on Dec 9, 2016

    @mathvav
    Contributor

    So are path params currently escaped? Query string values?

    (I agree that the router should use the raw path.)

  8. vishr commented on Dec 9, 2016

    @vishr
    Member

    Everything is raw.

  9. self-assigned this
    on Apr 26, 2017
  10. arun0009 commented on Apr 2, 2020

    @arun0009
    Contributor

    how to pass raw URL as is without decoding in proxy pass? I see that its decoding URL before sending it upstream

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions