[Http-webtest-general] Re: Error messages from StatusTest
Brought to you by:
m_ilya,
richardanderson
From: William M. <wi...@kn...> - 2002-10-02 12:58:01
|
On 2 Oct 2002 at 12:41, Ilya Martynov wrote: > Yes, I'm using LWP for networking operations. Yes, LWP generates such > error messages itself. When it encounters an error it just generates > HTTP::Response object with status code 500. Frankly I don't know if it is > possible at all to distinguish errors received from a server from LWP > generated errors (other than using regexps on error messages what is very > error prone). Hi Ilya, Thanks for the reply. I've created a test script using LWP which demonstrates the error message received when an invalid url is used or a valid url is used but a connection cannot be made (I disconnected my ethernet cable for this test). See code at end for my sample test. Both tests result in the following error message from LWP: "500 (Internal Server Error) Can't connect to www.yahoo.edu:80 (Bad hostname 'www.yahoo.edu')" That doesn't seem like a valid response from LWP. I've searched their mailling list archives and found one message which suggests that a 504 response should be returned for an invalid dns entry. However, I saw no discussion about what a timeout should return. I've just joined the list and posted this query. Should be interesting to see what feedback I get... I'll keep you posted. Cheers, William --------- #!/usr/bin/perl -Tw use strict; # # TESTING HTTP::RESPONSE # use LWP::UserAgent; use HTTP::Request; use HTTP::Response; my $url = 'http://www.yahoo.edu'; # invalid url #my $url = 'http://www.yahoo.com'; # valid url - be sure your connection times out to see error my $ua = LWP::UserAgent->new; my $request = HTTP::Request->new(GET => $url); my $response = $ua->request($request); if ($response->is_success) { print $response->content; } else { print $response->as_string; } ------------ -- Lead Developer Knowmad Services Inc. || Internet Applications & Database Integration http://www.knowmad.com |