GithubHelp home page GithubHelp logo

Comments (4)

mitsuhiko avatar mitsuhiko commented on May 7, 2024

The problem here is that this is still undefined behavior. A conforming WSGI implementation cannot give you the information if %2f or / was used in the URL so the reversal of that URL would not match unless path: is used in which case / is fine again.

from werkzeug.

benallard avatar benallard commented on May 7, 2024

Then why not leave that trouble for the WSGI middleware. The matcher is able to make the difference between %2f and / as you can see there:

http://paste.pocoo.org/show/319607/

Why shouldn't we do what locally (at the Map level) makes sense, not caring about which environment we might actually be running in ...

I'm still in favor of my patch (or similar).

from werkzeug.

mitsuhiko avatar mitsuhiko commented on May 7, 2024

Because Werkzeug is a WSGI library. The path passed to the match method is already unescaped, so at that point there is no %2f any more.

from werkzeug.

benallard avatar benallard commented on May 7, 2024

I made some tests and read a bit around, it and turns out that among all the servers I tested, Apache mod_wsgi is the only one behaving "according to the rules": it actually forward a '/' to the middleware if '%2f' appears in the URI. Encouraging me to remove all opportunities to get that '%2f' in the URI as part of a string variable,what I did.

Nevertheless, werkzeug own server does not unquote the URI before forwarding it to the middleware, and I still think that to keep the behavior consistent inside werkzeug, and get an idempotent operation, either my patch should be applied, or the server should unquote the '%2f'.

from werkzeug.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.