Scala Native TLSSocket#applicationProtocol behavior is inconsistent with JVM

Đang mở
#3,778 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 3 ngày

@reardonj đang làm issue này rồi.

Từ ngày 15/10/2026.

  • #3779 của @reardonj — đang mở

Đánh giá

Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức phù hợp với người mới
25/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Đình trệ
Công nghệ
scala
Lĩnh vực
networking

Hướng nghiên cứu

Start with the Scala Native TLSSocket#applicationProtocol implementation and compare it with the JVM version, which wraps the possibly null value in an Option and returns the empty string when no protocol is negotiated. The s2n method returning null and the guard call that throws are the points to examine. Pull request #3779 already targets this, so review or test that work rather than starting a parallel fix. Done means Scala Native returns the empty string when no protocol is negotiated, matching the JVM.

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

Mô tả

bug

Root cause of http4s issue: https://github.com/http4s/http4s/issues/7917

On Scala Native, when there is not applicationProtocol, the s2n method returns null and guard throws.
On JVM, the potentially null string is wrapped in an Option and a NoSuchElementException is thrown instead. When no protocol is negotiated, the result is the empty string.

http4s does not recover from the s2n exception, and IMO should not need to detect it. Instead, Scala Native's behaviour should be consistent with the JVM and return the empty string in this situation.

Prior Art

There is a PR from several years ago to add an option version of applicationProtocol: https://github.com/typelevel/fs2/pull/3215. While the overall API here could be improved, a fix for the Scala Native behavior could have a much smaller scope.

The applicationProtocol behavior also came up in https://github.com/http4s/http4s/pull/7963 where it was observed that FS2 JS also matches the JVM behaviour by turning false into the empty string

Ngôn ngữ chính
Scala
Star
2.5k
Fork
633
Merge trung bình
3 ngày 21 giờ
Pull request đã merge (30 ngày)
13

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 typelevel/fs2

Tất cả issue của typelevel/fs2

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.