in reply to Re: LWP::UserAgent destroys $response->content >:{
in thread LWP::UserAgent destroys $response->content >:{
and go to a lower level or I could use the filename method and read the legitimate content back in - but I'd rather fix the UserAgent than patch it! ;)$response = $ua->request($request.......);
Steve Potter http://www3.sympatico.ca/steven.potter/. . use AppConfig; use File::Basename; use Getopt::Long; use HTML::Form; use HTTP::Request::Common; use HTML::TreeBuilder; use LWP::DebugFile ('+'); use LWP::UserAgent; use Pod::Usage; use URI::file; . . $ua = LWP::UserAgent->new(); $ua->agent('Mozilla/4.0'); $ua->max_size('5000'); . . $ua->credentials($netloc, $realm, $userid, $passwd); . . $request = HTTP::Request->new(GET => "http://192.168.1.1/Status.htm"); $response = $ua->request($request); #$response = $ua->request($request,"rspfile.html"); if ($response->is_error) { my $string; print "Error: " . $response->status_line . "\n"; print $response->error_as_HTML; $string = $response->as_string; die "$string\n"; } . . ---------------- FreeBSD/i386 (blah blah blah) login: steve Password: Last login: Wed May 21 16:59:51 from 192.168.1.1 Copyright (c) 1980, 1983, 1986, 1988, 1990, 1991, 1993, 1994 The Regents of the University of California. All rights reser +ved. FreeBSD 4.7-RELEASE (ACCESS) #0: Tue Feb 11 19:33:55 EST 2003 Welcome blah blah blah steve> cd perlstuff steve/perlstuff> ./LinkSys.pl getting http://192.168.1.1/Status.htm... Error: 500 Can't read entity body: Connection reset by peer <HTML> <HEAD><TITLE>An Error Occurred</TITLE></HEAD> <BODY> <H1>An Error Occurred</H1> 500 Can't read entity body: Connection reset by peer </BODY> </HTML> 500 (Internal Server Error) Can't read entity body: Connection reset b +y peer Client-Date: Thu, 22 May 2003 12:43:11 GMT ----------------- Log:- # LWP::DebugFile logging to lwp_3eccc413_2a9d.log # Time now: {1053606945} = Thu May 22 08:35:45 2003 # Time now: {1053606959} = Thu May 22 08:35:59 2003 LWP::UserAgent::new: () # Time now: {1053606960} = Thu May 22 08:36:00 2003 LWP::UserAgent::request: () LWP::UserAgent::send_request: GET http://192.168.1.1/Status.htm LWP::UserAgent::_need_proxy: Not proxied # Time now: {1053606965} = Thu May 22 08:36:05 2003 LWP::Protocol::http::request: () # Time now: {1053606966} = Thu May 22 08:36:06 2003 LWP::Protocol::collect: read 340 bytes LWP::UserAgent::request: Simple response: Unauthorized # Time now: {1053606967} = Thu May 22 08:36:07 2003 LWP::UserAgent::request: () LWP::UserAgent::send_request: GET http://192.168.1.1/Status.htm LWP::UserAgent::_need_proxy: Not proxied LWP::Protocol::http::request: () LWP::Protocol::collect: read 903 bytes LWP::Protocol::collect: read 3770 bytes LWP::UserAgent::request: Simple response: Internal Server Error ttyp0://access/home/steve/perlstuff>
|
|---|