python / python/peps

PEP 3333: URL-decoding and routing

オープン
#3,280 コメント 3 件 リアクション 7 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

主要言語
reStructuredText
スター
5k
フォーク
1.8k
平均マージ
2日 4時間
マージ済み PR(30日)
25

説明

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.

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

まず PEP 3333 とリンク先の Starlette の議論を読み、そこで説明されているルーティングの動作を RFC 3986 のセクション 2.2 および 2.4 と比較してください。プロジェクトがパーセントエンコードされたパスコンポーネントをどのように扱うべきかについて、正確な明確化に合意できた時点で作業は完了です。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
python
領域
api, backend, documentation
issue の種類
ドキュメント
難易度
5/5
見積もり時間
1週間以上
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
25/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。