fukamachi / clack

Web server abstraction layer for Common Lisp
MIT License
1.05k stars 86 forks source link

Resolve :address before start the web server. (fixes #165) #166

Closed fukamachi closed 3 years ago

fukamachi commented 3 years ago

"localhost" won't be accepted by some web servers like wookie. This adds usocket as a dependency.

svetlyak40wt commented 3 years ago

Unfortunately, this will not work if address is IPv6 only. In this case vector quiad will give wrong results:

PLAYGROUND> (usocket:get-host-by-name "ipv6.test-ipv6.com")
#(32 1 4 112 0 1 0 24 0 0 0 0 0 0 1 21)
PLAYGROUND> (usocket:vector-quad-to-dotted-quad *)
"32.1.4.112"

It should be resolved to IPv6:

[art@art-osx:~]% host ipv6.test-ipv6.com
ipv6.test-ipv6.com has IPv6 address 2001:470:1:18::115
svetlyak40wt commented 3 years ago

Probably, you need to call either vector-quad-to-dotted-quad or vector-to-ipv6-host depending on vector length:

PLAYGROUND> (usocket:vector-to-ipv6-host **)
"2001:470:1:18::115"
svetlyak40wt commented 3 years ago

Oh, I found a solution inside the usocket:

CL-USER> (usocket:get-host-by-name "ipv6.test-ipv6.com")
#(32 1 4 112 0 1 0 24 0 0 0 0 0 0 1 21)
CL-USER> (usocket:host-to-hostname *)
"2001:470:1:18::115"