Skip Menu |
 

This queue is for tickets about the URI CPAN distribution.

Report information
The Basics
Id: 104301
Status: new
Priority: 0/
Queue: URI

People
Owner: Nobody in particular
Requestors: bitcard [...] 32ths.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in:
  • 1.60
  • 1.61
  • 1.62
  • 1.63
  • 1.64
  • 1.65
  • 1.66
  • 1.67
Fixed in: (no value)



Subject: URI confused by port numbers with no scheme?
Download (untitled) / with headers
text/plain 1.4k
use URI; my $URI = new URI->new('something.com:3128'); print $URI->scheme,"\n"; Results in output 'something.com' Tracked this down after my cpanm as not working when attempting to use $http_proxy and $https_proxy environment variables. I kept getting the error: 501 Protocol scheme 'myproxy.com:3128' is not supported. This is because I had http_proxy set to myproxy.com:3120, and cpanm calls LWP::UserAgent with env_proxy => 1. At some point, LWP::UserAgent calls $uri->scheme and it returns myproxy.com instead of undef. Snip from LWP::UserAgent send_request: # Locate protocol to use my $proxy = $request->{proxy}; if ($proxy) { $scheme = $proxy->scheme; } unless ($protocol) { $protocol = eval { LWP::Protocol::create($scheme, $self) }; $proxy is a URI::_foreign which is URI::_generic which overrides "no_scheme_ok" as being true. so calling $proxy->scheme returns the proxy name, then it tries to load that as a protocol resulting in the above error. I got lost when tracking down how calling ->scheme returns the hostname. URI version 999 required--this is only version 1.60. LWP::UserAgent version 999 required--this is only version 6.05. Also installed URI 1.67 via local::lib and same results (something.com returned as ->scheme). THe workaround (at least for cpanm) is to call the (as far as I can tell) undocumented --no-lwp command line option. Thanks, \- Mike
Download (untitled) / with headers
text/plain 395b
I dont know, maybe I'm mis-reading something, but from what i can tell something.com:3128 is not a valid URI according to my brief reading of RFC 2396. Seems the convention of http_proxy and https_proxy not having the scheme specified is odd (and not valid) since they do not seem like valid relative URIs Was looking at: https://www.ietf.org/rfc/rfc2396.txt Page 26, the BNF for URI. \- Mike
Download (untitled) / with headers
text/plain 208b
the scheme being the hostname comes from URI.pm new: my $impclass; if ($uri =~ m/^($scheme_re):/so) { $scheme = $1; } which seems like a valid thing to do after reading the RFC. \- Mike


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

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