develooper Front page | perl.libwww | Postings from December 2000

HTTP Status 302 "Moved to <same link>" ??

Thread Next
From:
Luis 'Champs' de Carvalho
Date:
December 13, 2000 05:19
Subject:
HTTP Status 302 "Moved to <same link>" ??
Message ID:
Pine.LNX.4.21.0012131102420.1047-100000@lobster.tbn.com.br
	
	Hy, list people.
	I'm writting a full-featured rewriting proxy using apache's
mod_perl, LWP and some others libs.
	
	Everithing works very well 'till i try to fetch some simple
pages. It's not allways, but i'm getting something like "302 Found". Here
is my logs, where the error appears:

	===============================================

[Wed Dec 13 11:05:34 2000] [debug]
/Apache/Proxy/MyProxy/HTTP.pm(75): LWP::UserAgent mimics Mozilla/4.73 [en]
(X11; I; Linux 2.2.17 i686).

[Wed Dec 13 11:05:35 2000] [debug]
/Apache/Proxy/MyProxy/HTTP.pm(100): Request Error: 302 Found

[Wed Dec 13 11:05:35 2000] [debug] 
/Apache/Proxy/MyProxy.pm(99): (F|HT)TPS? Headers sucessfully sent.

[Wed Dec 13 11:05:35 2000] [debug] /Apache/Proxy/MyProxy.pm(105): Content
sucessfully sent.


	================================================

	I'm using a "cake recipe" for fetching pages, here is the code:
	
	---------------------------------------------------
# $r is the apache's request object
# $uri is a string with the uri passed as parameter from the client
package Apache::Proxy::MyProxy::HTTP;
use Apache;
use Apache::server;
use Apache::log;
use LWP::UserAgent;
use constant UA  => new LWP::UserAgent;
use constant LOG => Apache->server->log;

sub handle_http( $$ ){
	my ( $r, $uri ) = ( shift, shift );
	#
	# Build a brand-new HTTP::Request to send to the remote webserver... 
	#
	my $request;
	$request = new HTTP::Request( 
				     GET => $uri, new HTTP::Headers(
				     $r->headers_in ), 
				     $r->content
	                            );
  
	# Fetch cookies from the cookie jar, insert into $request headers
	# **TODO**
	
	# $response is an HTTP::Response object
	my $response = UA->request($request);
	
	if ($response->is_success) {
	  LOG->debug( 'Request completed sucessfully. ['.$response->status_line.'].' );
	} else {
	  $response->content( $response->error_as_HTML );
	  LOG->debug( 'Request Error: '. $response->status_line );
	}
	return $response;
}
	-------------------------------------------

	Everything looks ok for me, but i still getting 302 from some
pages (not all pages, just a few) and still able to browse the pages
directly (from the same machine) with netscape...	
	
	Could anybody help me?
	
	Thanx you all in advance. :-)

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Luis 'Champs' de Carvalho           @  @     @
Sys Admin @ tbn.com.br             @@@ @@ @@@@
Phone:+55(011)3879.1300 (R.7036)    @  @@ @
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=


Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About