Scala Native TLSSocket#applicationProtocol behavior is inconsistent with JVM

Abierto
#3,778 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 3 días

@reardonj ya está trabajando en esto.

Desde el 15/10/2026.

  • #3779 de @reardonj — abierto

Evaluación

Dificultad
2/5
Tiempo estimado
1-3 horas
Aptitud para principiantes
25/100
Tipo de issue
Error
Claridad
Bien especificado
Estado de actividad
Estancado
Stack tecnológico
scala
Área
networking

Línea de trabajo

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.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

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

Lenguaje dominante
Scala
Estrellas
2.5k
Forks
633
Merge medio
3 d 21 h
PR fusionados (30 d)
13

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de typelevel/fs2

Todos los issues de typelevel/fs2

Issues similares

Más issues de Scala

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.