HTTP::Request->parse() handles leading double slashes in path incorrectly [rt.cpan.org #59570]
まだ誰も着手していません。
評価
調査の方向性
HTTP::Request->parse から始め、結果を URI の例と比較して、issue に示されている request-target のケースを再現してください。レポートで説明されている HTTP/1.1 の request-target 形式を確認してください。絶対パスの先頭にある二重スラッシュが authority として扱われず、他の形式は引き続き正しくパースされれば完了です。
索引モデルが issue の本文から書いたものです。
説明
Migrated from rt.cpan.org#59570 (status was 'new')
Requestors:
From [email protected] on 2010-07-20 16:09:22:
use strict;
use URI;
use HTTP::Request;
my $request = HTTP::Request->parse('GET //foo/bar/baz?uvw#xyz HTTP/1.1');
warn $request->uri->authority;
my $uri = URI->new('//foo/bar/baz?uvw#xyz');
warn $uri->authority;
__END__
Output is "foo" both times. With libwww-perl 5.827 and URI 1.38.
The problem is caused by URI being too relaxed about the format of a
URI. But I guess that cannot be fixed because it would break a lot of
existing code.
I think HTTP::Request->parse must be changed. The Request-URI of the
Request-Line in HTTP/1.1 is either a *, an absolute URI, an absolute
path, or an authority.
Unfortunately my version of URI is too smart for being fixed here:
my $uri = URI->new;
$uri->path('//foo/bar/baz');
warn $uri->authority;
This spits out a friendly warning that a leading double slash is
confusing, and it then happily forgets that this is just the path, not
an authority.
In fact, a leading double slash in a path is not really confusing but it
is perfecly legal and all browsers send such requests, and they conform
to HTTP here.
I have no idea how this could be fixed in a clean way without giving up
the blessed-scalar-approach for URI. But it basically renders the
HTTP::Request->parse() method useless.
Cheers,
Guido
- 主要言語
- Perl
- スター
- 32
- フォーク
- 62
- PR マージ指標
- 30日以内にマージされた PR はありません
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
libwww-perl/HTTP-Message のほかの issue
-
難易度 1/5 1時間未満 初心者へのやさしさ 88/100
libwww-perl/HTTP-Message#228 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
libwww-perl/HTTP-Message#227 ·
-
難易度 3/5 1〜2日 初心者へのやさしさ 42/100
libwww-perl/HTTP-Message#216 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 35/100
libwww-perl/HTTP-Message#207 · コメント 1 件 ·
-
Decoding of deflate content-encoding doesn't respect max_body_size対応中かも @simbabque が 539 日前に担当しました。 オープン
libwww-perl/HTTP-Message#206 · コメント 1 件 · 担当者 1 名 ·
libwww-perl/HTTP-Message の issue をすべて見る
似ている issue
-
enhancement
難易度 2/5 1〜3時間 初心者へのやさしさ 67/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 83/100
LMS-Community/slimserver#1692 · コメント 6 件 ·
メンテナーはふだん 1 日以内に返信
-
fix(api): API v3 Product Read ignores request language (lc) for sample products and image URLs対応中かも @muntasir-396 が 3 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
openfoodfacts/openfoodfacts-server#15042 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
メンテナーはふだん 1 日以内に返信