Closed C-Entropy closed 3 years ago
Confirmed. "cl-async" seems to reject the address.
As usocket:vector-quad-to-dotted-quad
can convert the vector into a string, it won't be a difficult change.
CL-USER> (usocket:vector-quad-to-dotted-quad (usocket:get-host-by-name "localhost"))
"127.0.0.1"
CL-USER> (usocket:vector-quad-to-dotted-quad (usocket:get-host-by-name "127.0.0.1"))
"127.0.0.1"
CL-USER> (usocket:vector-quad-to-dotted-quad (usocket:get-host-by-name "192.168.1.1"))
"192.168.1.1"
CL-USER> (usocket:vector-quad-to-dotted-quad (usocket:get-host-by-name "google.com"))
"172.217.161.46"
This adds usocket as a dependency of Clack, but I'm not sure if it's acceptable.
Or maybe better to point out that? Since some one may just use "localhost".
usocket is a quite thin library so that it shouldn't be a problem. I opened a PR at #166. Please check if it works for you.
It looks like you have not accept it yet. I'm sorry that I don't now how to test a PR that have not been merged yet. But the code look ok to me.
Okay, it works for me. Close. Thank you @fukamachi !
when do something like:
It gives:
Invalid address passed (not IPv4 or IPV6): "localhost"
Although we can avoid this without using "localhost". I think it is not a bad idea to change the default value.
And as @svetlyak40wt mentioned here, it may be a good choice to use something like:
(usocket:get-host-by-name "localhost")