Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

500 error on a simple request

by sylph001 (Sexton)
on Sep 24, 2014 at 16:01 UTC ( #1101820=perlquestion: print w/replies, xml ) Need Help??

sylph001 has asked for the wisdom of the Perl Monks concerning the following question:

 

Dear Monks,

I had a web grabbing program (using LWP) successfully running on 3 environments previously.

The 3 environments are Test, Pre-Prod, and Prod.

However today the program on Pre-Prod begins to get '500' error when making its first GET to fetch the raw web page. (it fetches the web page so that to start the login process)

Then, I changed the request to be 'POST', but no luck...

So, I'm wondering if anything wrong, because the Test env (using proxy) and the Prod env (without proxy) are working good, but just the Pre-Prod...

I paste the code to make the simple requeste and also the detailed '500' response here:

 

Request

   200      my $res = $ua->request(POST $gLoginURL);
   201     
   202      if ( !$res->is_success ) {
   203          $self->{log}->die("ERROR:\t" . Dumper($res));
   204      }

 

BAD response

2014/09/24 10:34:30 CRITICAL: FATAL: ERROR:     $VAR1 = bless( {
                 '_content' => '500 Can\'t connect to www.xxxxxxxx.com:80 (Bad hostname \'www.xxxxxxxx.com\')
',
                 '_rc' => 500,
                 '_headers' => bless( {
                                        'client-warning' => 'Internal response',
                                        'client-date' => 'Wed, 24 Sep 2014 14:34:30 GMT',
                                        'content-type' => 'text/plain'
                                      }, 'HTTP::Headers' ),
                 '_msg' => 'Can\'t connect to www.xxxxxxxx.com:80 (Bad hostname \'www.xxxxxxxx.com\')',
                 '_request' => bless( {
                                        '_content' => '',
                                        '_uri' => bless( do{\(my $o = 'http://www.xxxxxxxx.com/Pages/profile.aspx')}, 'URI::http' ),
                                        '_headers' => bless( {
                                                               'user-agent' => 'libwww-perl/5.804',
                                                               'content-type' => 'application/x-www-form-urlencoded',
                                                               'content-length' => 0
                                                             }, 'HTTP::Headers' ),
                                        '_method' => 'POST'
                                      }, 'HTTP::Request' )
               }, 'HTTP::Response' );

 

Please, I pray for your help on getting this problem solved.

 

Thanks in advance

Replies are listed 'Best First'.
Re: 500 error on a simple request
by blue_cowdawg (Monsignor) on Sep 24, 2014 at 16:07 UTC
        '500 Can\'t connect to www.xxxxxxxx.com:80 (Bad hostname \'www.xxxxxxxx.com\')

    This looks to be a DNS issue and not a Perl issue. If the hostname cannot be resolved have a word with your network support folks and find out why. You could to a

    nslookup www.xxxxxxxx.com
    or
    host www.xxxxxxxxxx.com
    and see if it resolves from the command line.


    Peter L. Berghold -- Unix Professional
    Peter -at- Berghold -dot- Net; Blog: http://blog.berghold.net Warning: No political correctness allowed.

      Here's result from nslookup and also resolv.conf file.

      It seems the first nameserver in the list doesn't work but the second does.

      Does that mean my perl program always uses the first nameserver from the list?

      Any suggestions what I should do before getting to support guys?

      $ /usr/sbin/nslookup www.xxxxxxxx.com
      ;; Got recursion not available from 172.25.226.13, trying next server
      Server:         172.25.229.141
      Address:        172.25.229.141#53

      Non-authoritative answer:
      Name:   www.xxxxxxxx.com
      Address: 207.xxx.xx.xxx

      $ more /etc/resolv.conf
      options timeout:2 retrans:1 retry:1
      domain xxxxxxxx
      nameserver 172.25.226.13
      nameserver 172.25.229.141
      nameserver 172.25.226.16

        Hi,

        Do the same on the other two systems, present everything to Support and ask them if they have been messing with the system that has stop working properly.

        Ask nicely, it's best to stay friends with Support

        J.C.

Re: 500 error on a simple request
by ikegami (Pope) on Sep 24, 2014 at 16:08 UTC
    Bad hostname 'www.xxxxxxxx.com' means it wasn't able to resolve the www.xxxxxxxx.com into an IP address.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://1101820]
Approved by blue_cowdawg
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (1)
As of 2021-11-30 01:13 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?