HTTP header list parsing does not accept empty list elements

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

Maintainer thường phản hồi trong vòng 1 ngày

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

Đánh giá

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

Hướng nghiên cứu

Start with the list parsing rules used by HttpHeader.parse and compare them with Range’s existing handling of leading empty elements. Check downstream handling of unrecognized Connection headers, especially whether close is honored. Done when leading, interior, and trailing empty elements parse as required across list headers, the all-empty case is decided for required lists, and tests cover these cases.

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

Mô tả

RFC 9110 §5.6.1 (previously RFC 7230 §7) says a recipient must parse and ignore a reasonable number of empty list elements. Most header list rules use oneOrMore(...).separatedBy(listSep) or the zeroOrMore equivalent, which does not allow them, so these headers are not parsed into their modeled types and stay RawHeaders:

Header Value
Cache-Control no-store,, public
Cache-Control , no-store, public
Cache-Control no-store, public,
Connection close,, foo
Allow GET,, POST
If-None-Match "a",, "b"
Accept text/plain,, text/html

These were found by parsing each value with HttpHeader.parse. They are a sample, and other headers using the same rules are likely to behave the same way. Range already tolerates leading empty elements with zeroOrMore(ws(',')).

Things to look at:

  • Interior, leading and trailing empty elements all need handling, so this probably means changing each list rule or adding a shared helper, not only listSep.
  • Decide how a list with no elements at all (for example Cache-Control: ,) should behave for headers that require at least one.
  • Check what happens downstream when a header stays a RawHeader, starting with Connection, since a close that is not recognised could change connection handling.

Follow-up to #1395, which fixes whitespace before the list separator but does not change how empty elements are handled.

Ngôn ngữ chính
Scala
Star
199
Fork
57
Merge trung bình
1 ngày 20 giờ
Pull request đã merge (30 ngày)
54

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 apache/pekko-http

Tất cả issue của apache/pekko-http

Issue tương tự

Thêm issue về Scala

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.