Bug#524127: [uscan] 'x509_user' not valid URI scheme at /usr/bin/uscan line 389

gregor herrmann gregoa at debian.org
Fri Apr 17 16:28:04 UTC 2009


On Thu, 16 Apr 2009 06:53:20 +0100, Adam D. Barratt wrote:

> Aha! This seems to be due to a change made upstream in libwww-perl in
> version 5.821:
>       croak on bad proxy args [RT#39919]

Ack.
 
> This is easily confirmable by checking whether the following also fails
> for you:
> 
>         #! /usr/bin/perl
>         use LWP::UserAgent;
>         my $ua = LWP::UserAgent->new(env_proxy => 1);
>         
> env_proxy is documented as reading environment variables of the form
> *_proxy.

For some values of '*':

$ FOO_BAR_PROXY=BAZ perl proxy.pl
'foo_bar' is not a valid URI scheme at proxy.pl line 3
$ FOO_PROXY=BAZ perl proxy.pl
Proxy must be specified as absolute URI; 'BAZ' is not at proxy.pl line 3

The reason for this behaviour is:
    Carp::croak("'$key' is not a valid URI scheme") unless $key =~ /^$URI::scheme_re\z/;
    ..
    Carp::croak("Proxy must be specified as absolute URI; '$url' is not") unless $url =~ /^$URI::scheme_re:/;

With some debug output:

$ PERL5LIB=/home/gregoa/src/svn-pkg-perl/trunk/libwww-perl/lib FOO_BAR_PROXY=BAZ perl proxy.pl
$VAR1 = 'scheme: [a-zA-Z][a-zA-Z0-9.+\\-]*z';
$VAR2 = 'key: foo_bar';
'foo_bar' is not a valid URI scheme at proxy.pl line 3
$ PERL5LIB=/home/gregoa/src/svn-pkg-perl/trunk/libwww-perl/lib FOO_PROXY=BAZ perl proxy.pl
$VAR1 = 'scheme: [a-zA-Z][a-zA-Z0-9.+\\-]*z';
$VAR2 = 'key: foo';
$VAR1 = 'scheme: [a-zA-Z][a-zA-Z0-9.+\\-]*:';
$VAR2 = 'url: BAZ';
Proxy must be specified as absolute URI; 'BAZ' is not at proxy.pl line 3

So, first of all LWP::UserAgent "only" grabs *_proxy variables when
'*' doesn't contain an '_'. I don't know if there is a specific
reason for that, but that's why X509_USER_PROXY triggers the first
Carp::Croak.

And then LWP::UserAgent expects an URL with a colon which doesn't
seem to be unreasonable, but in Steffen's case it would croak too.
The following works without any warnings:

$ PERL5LIB=/home/gregoa/src/svn-pkg-perl/trunk/libwww-perl/lib FOO_PROXY=file://BAZ perl proxy.pl
$VAR1 = 'scheme: [a-zA-Z][a-zA-Z0-9.+\\-]*z';
$VAR2 = 'key: foo';
$VAR1 = 'scheme: [a-zA-Z][a-zA-Z0-9.+\\-]*:';
$VAR2 = 'url: file://BAZ';

> LWP maintainers - any thoughts? Should clients (e.g. uscan) be
> attempting to sanitise the proxy variables in the environment to only
> include those they specifically care about before using env_proxy? (or
> wrapping the call in an eval() and ignoring the specific error)
> 
> That's obviously doable, but would need doing in every client
> individually, which seems somewhat overkill.

Good question; IMO the new behaviour of LWP::UserAgent is indeed a
bit unexpected and has room for improvement. But I'm not sure what
exactly to propose to upstream ...


Cheers,
gregor
-- 
 .''`.   Home: http://info.comodo.priv.at/{,blog/} / GPG Key ID: 0x00F3CFE4
 : :' :  Debian GNU/Linux user, admin, & developer - http://www.debian.org/
 `. `'   Member of VIBE!AT, SPI Inc., fellow of FSFE | http://got.to/quote/
   `-    NP: Alanis Morisette: You Learn
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: Digital signature
URL: <http://lists.alioth.debian.org/pipermail/pkg-perl-maintainers/attachments/20090417/c55e771b/attachment.pgp>


More information about the pkg-perl-maintainers mailing list