Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

HTTP::Request->parse() handles leading double slashes in path incorrectly [rt.cpan.org #59570]

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

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

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
45/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
停滞
技術スタック
perl
領域
api, backend

調査の方向性

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 はありません

環境構築

はじめの一歩

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

libwww-perl/HTTP-Message のほかの issue

libwww-perl/HTTP-Message の issue をすべて見る

似ている issue

Perl の issue をもっと見る

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

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