chansen / p5-http-tiny

Tiny HTTP Client
https://metacpan.org/dist/HTTP-Tiny
53 stars 52 forks source link

Strange warnings for non-HTTP/HTTPS URLs #139

Closed tobyink closed 3 years ago

tobyink commented 4 years ago

Example

my $ua = 'HTTP::Tiny'->new;
my $res = $ua->get('hxxps://example.com/');

Current Behaviour

This produces the following warning:

Use of uninitialized value in numeric eq (==)

And it returns a response saying that the request resulted in an internal error.

Expected Behaviour

A response saying that the request resulted in an internal error but no visible warning.

Explanation

This is because of a comparison $port == $DefaultPort{$scheme} and $DefaultPort{$scheme} is undef because there's no such key.

Possible Solution

no warnings qw( uninitialized numeric );