Skip Menu |

This queue is for tickets about the HTTP-Recorder CPAN distribution.

Report information
The Basics
Id: 14388
Status: resolved
Priority: 0/
Queue: HTTP-Recorder

People
Owner: Nobody in particular
Requestors: httprecorder.20.cd [...] spamgourmet.com
Cc:
AdminCc:

Bug Information
Severity: Critical
Broken in: 0.05
Fixed in: (no value)



Subject: Can't locate object method "query_param...
Module: HTTP::Recorder Version: perl -MHTTP::Recorder -e 'use HTTP::Recorder; print HTTP::Recorder->VERSION, "\n";' 0.05 OS Environment: uname -a Linux bitspot 2.6.9-11.ELsmp #1 SMP Wed Jun 8 17:54:20 CDT 2005 i686 i686 i386 GNU/Linux Perl Version: perl -v This is perl, v5.8.5 built for i386-linux-thread-multi... Script (essentially the same as the synopsis, but with two more use lines and with a port specified): ################# snip ################### #!/usr/bin/perl use HTTP::Proxy; use HTTP::Recorder; use URI::QueryParam; use HTTP::Request::Params; my $proxy = HTTP::Proxy->new( port => 3128 ); # create a new HTTP::Recorder object my $agent = new HTTP::Recorder; # set the log file (optional) $agent->file("/tmp/myfile"); # set HTTP::Recorder as the agent for the proxy $proxy->agent( $agent ); # start the proxy $proxy->start(); 1; ################# snip ################### Error message: Can't locate object method "query_param" via package "rec-action=submitform&rec-formname=login&rec-formnumber=1&rec-form1-hidden-action=1&action=authenticate&rec-form1-hidden-javascriptEnabled=1&javascriptEnabled=1&rec-form1-text-loginId=1&loginId=someuserid&rec-form1-password-password=1&password=somepassword" (perhaps you forgot to load "rec-action=submitform&rec-formname=login&rec-formnumber=1&rec-form1-hidden-action=1&action=authenticate&rec-form1-hidden-javascriptEnabled=1&javascriptEnabled=1&rec-form1-text-loginId=1&loginId=someuserid&rec-form1-password-password=1&password=somepassword"?) at /usr/lib/perl5/site_perl/5.8.5/HTTP/Recorder.pm line 347. Comment: I see that multiple users have been experiencing this problem, and nobody is offering any useful help: http://aspn.activestate.com/ASPN/Mail/Message/perl-macosx/2789778 http://lists.bestpractical.com/pipermail/http-recorder/2005-August/000058.html Note that while for the first case, Gisle Aas offered a suggestion, that suggestion did not fix the problem. Neither of the above two posters is me. I am trying something very, very simple, a login to a two-field form page, through Firefox which is pointing to the proxy. It is writing to the log file, but the submit is not going through in the browser, so the browser stays at the login page without logging in, and the script prints out the error message pasted above. Please visit your email lists and relevant web sites and tell people how to fix this! Thanks!
From: kerberus [...] accidia.net
[guest - Wed Aug 31 20:49:07 2005]: The problem seems to appear when $self->unmodify is called passing it a plain string and not the expected URI::QueryParam object. This appear on line 314: 312 # undo what we've done 313 $request->uri($self->unmodify($request->uri)); 314 $request->content($self->unmodify($request->content)); 315 It seems that commenting that line prevent HTTP::Recorder to crash but I'm aware of others implications of this change.
[guest - Thu Sep 1 03:01:52 2005]: Show quoted text
> The problem seems to appear when $self->unmodify is called passing it a > plain string and not the expected URI::QueryParam object.
Thanks. So is there a way to change the plain string into a URI::QueryParam object before that call? Show quoted text
> ... > It seems that commenting that line prevent HTTP::Recorder to crash but > I'm aware of others implications of this change.
If you are aware of other implications, would it be possible for you to please mention what those implications are? Thanks very much in advance.
Subject: Can't locate object method
The trunk build does not return error for me but it does not record interaction with websites. I am using FreeBSD 4 with perl 5.6. On Fri Jan 13 07:39:37 2006, neuhaus wrote: Show quoted text
> The version checked into the trunk on the SVN works. Grab the tar from >
http://www.bitmistress.org/websvn/dl.php?repname=HTTP%3A%3ARecorder&path=%2Ftrunk%2Flib%2FHTTP%2F&rev=0&isdir=1
This solution worked for me: http://lists.fsck.com/pipermail/http-recorder/2007-October/000083.html I'm quoting it here for your convenience: Show quoted text
> > A google search returned several complaints about the error "Can't > locate object method "query_param"". Thanks to a tip from Praveen > Hombaiah (http://lists.bestpractical.com/pipermail/http-recorder/2006- > February/000077.html), I diffed the subroutine causing my complaints > from HTTP-Recorder version 0.05 with the one in HTTP-Recorder version > 0.03_03 (http://search.cpan.org/src/LEIRA/). > > If you edit your version of /lib/HTTP/Recorder.pm and comment out the > "for ... $content->query_param" section and paste in Leira's original > content, then your proxy script should work. > > > sub unmodify { > my $self = shift; > my $content = shift; > > return $content unless $content; > > # get rid of the arguments we added > my $prefix = $self->{prefix}; > > #HIDE THIS > #for my $key ($content->query_param) { > #if ($key =~ /^$prefix-/) { > # $content->query_param_delete($key); > #} > #} > > #ADD THIS > $content =~ s/$prefix-(.*?)\?(.*?)&//g; > $content =~ s/$prefix-(.*?)&//g; > $content =~ s/$prefix-(.*?)$//g; > $content =~ s/&$//g; > $content =~ s/\?$//g; > > return $content; > } >
Bernhard
Subject: Can't locate object method "query_param... | Patch attached
Here's a patch that fixes this issue for the most recent version on CPAN ( 0.05 ) It applies cleanly and solves the problem without bypassing the functionality of the code that throws the error (it recasts the string as a URI::http object before query_params() is called on it) Initially I emailed the author directly, because RT was down, but this way anybody else who encounters this bug can just apply this patch to the unpacked tarball before building.
--- lib/HTTP/Recorder.pm.orig 2009-05-30 11:41:38.083094107 -0400 +++ lib/HTTP/Recorder.pm 2009-05-30 11:58:24.862173149 -0400 @@ -344,6 +344,9 @@ # get rid of the arguments we added my $prefix = $self->{prefix}; + # bug fix for rt 14388 (sscaffidi) + $content = URI->new( $content ); + for my $key ($content->query_param) { if ($key =~ /^$prefix-/) { $content->query_param_delete($key);
Bug was fix, thanks for the patch. - Shmuel.