Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

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

Đang mở
#47 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức phù hợp với người mới
45/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Đình trệ
Công nghệ
perl
Lĩnh vực
api, backend

Hướng nghiên cứu

Bắt đầu với HTTP::Request->parse và tái hiện trường hợp request-target được nêu trong issue, đồng thời so sánh kết quả của nó với các ví dụ URI. Kiểm tra các dạng request-target của HTTP/1.1 được mô tả trong báo cáo; công việc được xem là hoàn tất khi dấu gạch chéo kép ở đầu một đường dẫn tuyệt đối không được xử lý như một authority, trong khi các dạng khác vẫn tiếp tục được phân tích chính xác.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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
Ngôn ngữ chính
Perl
Star
32
Fork
62
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của libwww-perl/HTTP-Message

Tất cả issue của libwww-perl/HTTP-Message

Issue tương tự

Thêm issue về Perl

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.