Suggestion for LWP:Useragent.pm

Lennart Svensson (lennart.svensson@ks.ericsson.se)
Sat, 22 May 1999 18:24:13 +0200


Hi,


I have make a HTTP scanning robot which work very well with
libwww SPAN but I have a problem with nodes returning error code
301 and 302

Is it possible to fix some method or something which inhibit
the redirection for those error code


The code I;m talking about is:
-------
    if ($code == &HTTP::Status::RC_MOVED_PERMANENTLY or
	$code == &HTTP::Status::RC_MOVED_TEMPORARILY) {

	# Make a copy of the request and initialize it with the new URI
	my $referral = $request->clone;

	# And then we update the URL based on the Location:-header.
	my $referral_uri = $response->header('Location');
	{
	    # Some servers erroneously return a relative URL for redirects,
	    # so make it absolute if it not already is.
	    local $URI::ABS_ALLOW_RELATIVE_SCHEME = 1;
	    my $base = $response->base;
	    $referral_uri = $HTTP::URI_CLASS->new($referral_uri, $base)
		            ->abs($base);
	}

	$referral->url($referral_uri);

	return $response unless $self->redirect_ok($referral);
--------

	The wish is that the last return should even response in case I
	have told the request that.

	Hope you understand my problem and have a good solution for it.


		regards
		lesve


$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
Lennart Svensson       | E-mail: lennart.svensson@ks.ericsson.se
Sr. Software Engineer  | Voice: (46) - 054 - 29 42 36
Ericsson Infotech AB   | ECN:          863 -    42 36
PO Box 1038            | Mobile:(46) - 0705  56 28 20
651 15 Karlstad Sweden | Fax:   (46) - 054 - 29 40 08
-----------------------------------------------------------------
My interest is in the future cause
 I`m gonna spend the rest of my life there
=================================================================