in reply to Bad hostname

LWP doesn't return such messages. Either the message isn't from LWP, or I think you're lying about the message. I presume you were actually getting something of the form

500 Can't connect to $host:$port (Bad hostname '$host')

If the message you are getting is the form

500 Can't connect to $host:$port ($error_cause)

then the error message is originating from the operating system while LWP was attempting to create a connection. If the OS is telling you there's a permission problem, then there's some OS-level security setting preventing you (the web server user) from creating internet connections.

Are you using SELinux? In any case, this isn't a Perl issue.

* — The 500 might be absent depending on how you got the message.

Replies are listed 'Best First'.
Re^2: Bad hostname
by alvise (Acolyte) on Sep 15, 2009 at 07:47 UTC

    I agree with you that the format of the typical LWP response is something like you have just stated. But the error message that I am forwarding in my posts is the status_line of the response object, not that of the user agent object.

    Far from me the idea of wasting your time (and mine) by faking the messages... I just copied and pasted them.

    Anycase I've disabled SELinux and the problem has been solved. But now another problem arises: should I leave SELinux disabled ???

    Thanks for taking the time to respond to me. A.

      the error message that I am forwarding in my posts is the status_line of the response object, not that of the user agent object.

      You are mistaken. It's LWP::UserAgent that places the error in the status line (after being generated by LWP::Protocol::http). That is how LWP reports errors.

      So yes, we were on the same page. Maybe older versions of LWP had different messages, sorry.

      Update: It would have to be a very old version. Older than libwww-perl-5.800, released on June 15th, 2004. That's the earliest version currently on CPAN.

Re^2: Bad hostname
by Anonymous Monk on Sep 14, 2009 at 04:43 UTC
    lwp-request http://nonsense/ 500 Can't connect to nonsense:80 (Bad hostname 'nonsense')
      Repeating me? What's your point?