The Plack suite commonly uses the http://0:port
. E.g. the following
plackup -MPlack::App::Directory -e 'Plack::App::Directory->new(root=>".");'
prints
HTTP::Server::PSGI: Accepting connections at http://0:5000/
However, the LWP::UserAgent
(or some deeper called modules) didn't accepts it, e.g. the:
perl -MLWP::UserAgent -E '$u=LWP::UserAgent->new;$res=$u->get("http://0:5000/valid/path");print $res->status_line'
prints:
500 No Host option provided
but the
perl -MLWP::UserAgent -E '$u=LWP::UserAgent->new;$res=$u->get("http://localhost:5000/valid/path");print $res->status_line'
prints
200 OK
The question is: who is wrong?
- Is the
http://0:port
valid, e.g. the LWP is "wrong" - or it isn't valid and the PSGI uses it as only "randomly valid" shortcut?
0
, it's (typically)127.0.0.1
. Try pinginglocalhost
to see the actual address. – Exhortationhttp://0:5000
is valid or no? Could/should be used or no? – Embarkment0
is the wildcard address used by servers when they want to listen to connections from all interfaces. It makes no sense trying to connect to it. – Exhortation