PEP 3333: URL-decoding and routing
Dieses Issue hat noch niemand übernommen.
- Vorherrschende Sprache
- reStructuredText
- Sterne
- 5k
- Forks
- 1.8k
- Ø Merge
- 2 T. 4 Std.
- Gemergte PRs (30 T.)
- 25
Beschreibung
There have been several discussions over the years about how WSGI frameworks apply routing in the case of URL-encoded path components. Here's a comment that links to a few of the discussions:
https://github.com/encode/starlette/pull/1828#issuecomment-1434043248
The issue is that when using routing features, the URL /user/foo/edit appears to be indistinguishable from /user/foo%2Fedit, and in case of routing rules for /user/{username} and /user/{username}/edit, the URL /user/foo%2Fedit will match the second rule and not the first.
This seems to me to be in conflict with RFC 3986 section 2.4 and RFC 3986 section 2.2. The latter states:
URIs that differ in the replacement of a reserved character with its corresponding percent-encoded octet are not equivalent.
But the routing mechanism in popular WSGI frameworks such as Flask and FastAPI are unable to differentiate the mentioned URLs, because the URI's percent-encoding is decoded before the routing happens.
I believe PEP-3333 needs to clarify the correct behaviour.
Beitragsleitfaden
Erste Schritte
- Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
- Forke das Repository und arbeite in einem Branch.
- Öffne einen Pull Request, der die Issue-Nummer nennt.
Rechercherichtung
Beginnen Sie mit der Lektüre von PEP 3333 und der verlinkten Starlette-Diskussion und vergleichen Sie anschließend das dort beschriebene Routing-Verhalten mit den Abschnitten 2.2 und 2.4 von RFC 3986. Die Arbeit ist abgeschlossen, wenn das Projekt eine Einigung über eine präzise Klarstellung erzielt hat, wie percentkodierte Pfadkomponenten behandelt werden sollen.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- python
- Bereich
- api, backend, documentation
- Issue-Typ
- Dokumentation
- Schwierigkeit
- 5/5
- Geschätzter Aufwand
- Über eine Woche
- Aktivitätsstatus
- Veraltet
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 25/100