WSGIPathInfoDispatcher sorts the path prefixes incorrectly

Anonymous avatarAnonymous created an issue

There is even a comment in the code saying that the prefixes should be sorted by prefix length, but then goes on and sorts them alphabetically anyway:

    # Sort the apps by len(path), descending

see: [source:trunk/cherrypy/wsgiserver/ wsgiserver.WSGIPathInfoDispatcher]

Reported by

Comments (3)

  1. Robert Brewer

    The URL's only need to be sorted by length if one is a subset of another; for example, you want '/path/to/abc' to match '/path/to/abc' before it matches '/path/to/ab'. The existing implementation did this just fine with `apps.sort(); apps.reverse()`. Feel free to go back to it if desired or if the new code causes any problems in the future.

  2. Log in to comment
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.