This queue is for tickets about the Net-OpenID-Consumer CPAN distribution.

Report information
The Basics
Id:
53968
Status:
resolved
Priority:
Low/Low

People
Owner:
crew [...] cs.stanford.edu
Requestors:
crew@cs.stanford.edu(no email address set)
Cc:
AdminCc:

BugTracker
Severity:
Critical
Broken in:
1.03
Fixed in:
  • 1.030099_006
  • 1.11



Subject: IndirectMessage.pm breaks on mod_perl 2.0
on an Apache2 server with mod_perl 2.0 and libapreq2 (Debian Linux 5.0), claimed_identity->check_url fails with Unknown parameter type (Apache2::Request(0x...)) In Net::OpenID::IndirectMessage.pm line 43 elsif (ref $what eq "Apache::Request") needs to be elsif ( ref($what) =~ m/^Apache2?::Request$/ ) { since both mod_perl 2 and libapreq2 use the 'Apache2' namespace (i.e., not 'Apache') almost exclusively Also, line 32 elsif (ref $what eq "Apache") { is puzzling, since (to my knowledge) there are never any vanilla 'Apache' objects, so I'm not sure how this EVER triggers. If the intent is to cover the case of mod_perl2? servers WITHOUT libapreq2? (is this configuration part of the test suite?), then I believe line 32 needs to be elsif ( ref($what) =~ m/^Apache2?::RequestRec$/) { (... can't test this one yet, so I don't know for certain..., but it seems likely...)
On Sun Jan 24 21:14:27 2010, crew@cs.stanford.edu wrote:
Show quoted text
> > Also, line 32 > > elsif (ref $what eq "Apache") { > > is puzzling, since (to my knowledge) there are never any vanilla > 'Apache' objects, so I'm not sure how this EVER triggers. If the
intent
Show quoted text
> is to cover the case of mod_perl2? servers WITHOUT libapreq2? (is this > configuration part of the test suite?), then I believe line 32 needs
to be
Show quoted text
> > elsif ( ref($what) =~ m/^Apache2?::RequestRec$/) { > > (... can't test this one yet, so I don't know for certain..., but it > seems likely...)
I don't really know what that's for. It was there from one of the very first versions of Net::OpenID::Consumer and so it's been maintained ever since for compatibility, but I don't really know where objects of this type come from. I think I remember them showing up in mod_perl 1.0, but I may have just imagined that.
CC: crew@cs.stanford.edu
Subject: [rt.cpan.org #53968] IndirectMessage.pm breaks on mod_perl 2.0
Date: Mon, 25 Jan 2010 16:20:10 -0800
To: bug-Net-OpenID-Consumer@rt.cpan.org
From: Roger Crew <admin@41dems.org>
Martin Atkins via RT writes:
Show quoted text
> <URL: https://rt.cpan.org/Ticket/Display.html?id=53968 > > > On Sun Jan 24 21:14:27 2010, crew@cs.stanford.edu wrote:
> > > > Also, line 32 > > > > elsif (ref $what eq "Apache") { > > > > is puzzling, since (to my knowledge) there are never any vanilla > > 'Apache' objects, so I'm not sure how this EVER triggers. If the > > intent is to cover the case of mod_perl2? servers WITHOUT libapreq2? > > (is this configuration part of the test suite?), then I believe > > line 32 needs to be > > > > elsif ( ref($what) =~ m/^Apache2?::RequestRec$/) {
ok,... I dug out the mod_perl 1 porting docs and this turns out to be wrong. mod_perl 1 *does* indeed bless the request object into 'Apache', and all of the methods called in the 'Apache' clause (->method, ->content, ->args) are consistent with $what being a mod_perl 1 Apache request object. And since both ->content and ->args in list context were eliminated for mod_perl 2, the clause to deal with mod_perl_2 WITHOUT libapreq2 will need to be totally different... ... and totally insane (see below). so you probably don't want to change line 32 after all. I'm also getting the impression it's generally assumed that anyone using mod_perl 2 also uses libapreq2, since otherwise there's this nightmare of the Right Way to suck in POST bodies to get at the parameters. (Presumably, libapreq2 will be merged into Apache Proper SOME day, but I'm still unclear on why it was ever separate in the first place.) Meanwhile, here's what an mod_perl_2-without-libapreq2 clause would have to look like (note that I have NOT gotten this to work...) | elsif (ref($what) eq 'Apache2::RequestRec') { | # EVIL | # EVIL -- This is ripped straight out of Apache2::compat | # EVIL | use constant IOBUFSIZE => 8192; | require Apache2::Const; # -compile => qw(MODE_READBYTES); | require APR::Const; # -compile => qw(BLOCK_READ); | require APR::Brigade; | | my $string; | if ($what->method eq 'POST') { | my $bb = APR::Brigade->new($what->pool, | $what->connection->bucket_alloc); | $string = ''; | my $seen_eos = 0; | do { | $what->input_filters->get_brigade($bb, Apache2::Const::MODE_READBYTES, | APR::Const::BLOCK_READ, IOBUFSIZE); | while (!$bb->is_empty) { | my $b = $bb->first; | if ($b->is_eos) { | $seen_eos++; | last; | } | if ($b->read(my $buf)) { | $string .= $buf; | } | $b->delete; | } | } while (!$seen_eos); | $bb->destroy; | } | else { | $string = $what->args; | } | my %get = (); | if (defined $string and $string) { | %get = map { | tr/+/ /; | s/%([0-9a-fA-F]{2})/pack("C",hex($1))/ge; | $_; | } split /[=&;]/, $string, -1; | } | $getter = sub { $get{$_[0]}; }; | $enumer = sub { keys(%get); }; | }
On Mon Jan 25 19:20:35 2010, admin@41dems.org wrote:
Show quoted text
> Martin Atkins via RT writes:
Show quoted text
> And since both ->content and ->args in list context were eliminated > for mod_perl 2, the clause to deal with mod_perl_2 WITHOUT libapreq2 > will need to be totally different... > > ... and totally insane (see below). > > so you probably don't want to change line 32 after all. > > I'm also getting the impression it's generally assumed that anyone > using mod_perl 2 also uses libapreq2, since otherwise there's this > nightmare of the Right Way to suck in POST bodies to get at the > parameters. (Presumably, libapreq2 will be merged into Apache Proper > SOME day, but I'm still unclear on why it was ever separate in the > first place.)
I don't see any great purpose in getting this to work without libapreq2. If someone is that desperate, they can just initialize a CGI object from the Apache2::RequestRec. But support for libapreq2/Apache2::Request is really needed. I've made the necessary one-line change in http://github.com/ysth/net-openid-consumer/tree/devel. The workaround is to do: Net::OpenID::Consumer->new( 'args' => sub { $apreq->param($_[0] } ... instead of the better: Net::OpenID::Consumer->new( 'args' => $apreq ... By the way, the changes in the unauthorized 1.05 release look good and useful. Can gugu be given co-maintainership?
I believe this is fixed in Net-OpenID-Consumer-1.11 If you want to try it out, please make sure you've also installed the latest Net-OpenID-Common. Feel free to re-open (or start a new ticket) if I'm mistaken about this. Thanks for the report and sorry this took so long to get to... - Roger Crew (new co-maintainer as of a few weeks ago)


This service runs on Request Tracker, is sponsored by The Perl Foundation, and maintained by Best Practical Solutions.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.