Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

WEBRick::HTTPServer creates ipv6only socket for host `::`

Aperta
#99 7 commenti 1 reazione 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
38/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Ferma
Stack tecnologico
ruby

Direzione di ricerca

Iniziare dalla riga 60 di lib/webrick/utils.rb e riprodurre il problema con l’esempio WEBrick::HTTPServer che usa Host: '::'. Confrontare il comportamento del socket con TCPServer.new('::', 8080), verificando con ss -tlne v6only e l’ascolto dual-stack. Il lavoro è completo quando l’host wildcard IPv6 di WEBrick si comporta come previsto per il traffico IPv4 e IPv6 sui sistemi Linux interessati.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

The IPv6 host :: is kind of analogous to the IPv4 address 0.0.0.0, however it should usually (depending on the OS) listen for traffic coming from IPv4 and IPv6 addresses, unless specified differently by the OS.

However, i have observed that across different linux distros i have tried (manjaro, arch, debian), WEBRick will open its socket in ipv6-only mode.
I assume that the reason is this line as using the Socket.tcp_server_sockets function manually leads to the same result.
However, e.g. using the TCPServer from the socket stdlib opens a socker that's not in ipv6-only mode.

Sample code i have used:

require 'webrick'

server = WEBrick::HTTPServer.new Port: 8080, Host: '::', DocumentRoot: '~/'

trap 'INT' do
  server.shutdown
end

server.start

I have tested this with webrick 1.7.0 on ruby 3.1.1 and on ruby 2.6.3, both yielding the same result.

I have observed the mode using ss -tlne, where the local address is shown as [::]:8080, which indicates ipv6-only mode in ss, while it should be *:8080 in non-ipv6-only mode.
It also says v6only:1 in the process description, while it should say v6only:0.

Also here's the sample code using TCPServer that correctly opens the socket:

require 'socket'

server = TCPServer.new('::', 8080)

loop do
  client = server_socket.accept
  client.puts 'hello'
  client.close
end
Lingua principale
Ruby
Stelle
327
Fork
113
Merge medio
4h 2m
PR unite (30g)
1

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di ruby/webrick

Tutte le issue di ruby/webrick

Issue simili

Altre issue su Ruby

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.