Subject: | $RE{URI}{HTTP} doesn't match https:// URLs. |
HTTP over SSL URLs are not currently matched, despite the code being there to match; it looks like a typo in Regexp/Common/URI/http.pm (patch attached).
Tests to reproduce:
perl -e 'use Regexp::Common qw(URI); print "$RE{URI}{HTTP}\n"; if ("https://somesite.com/" =~ m/$RE{URI}{HTTP}/) { print "Success!\n" } else { print "Ba-bow\n" }'
(?:(?:http)://(?:(?:(?:(?:(?:(?:[a-zA-Z0-9][-a-zA-Z0-9]*)?[a-zA-Z0-9])[.])*(?:[a-zA-Z][-a-zA-Z0-9]*[a-zA-Z0-9]|[a-zA-Z])[.]?)|(?:[0-9]+[.][0-9]+[.][0-9]+[.][0-9]+)))(?::(?:(?:[0-9]*)))?(?:/(?:(?:(?:(?:(?:(?:[a-zA-Z0-9\-_.!~*'():@&=+$,]+|(?:%[a-fA-F0-9][a-fA-F0-9]))*)(?:;(?:(?:[a-zA-Z0-9\-_.!~*'():@&=+$,]+|(?:%[a-fA-F0-9][a-fA-F0-9]))*))*)(?:/(?:(?:(?:[a-zA-Z0-9\-_.!~*'():@&=+$,]+|(?:%[a-fA-F0-9][a-fA-F0-9]))*)(?:;(?:(?:[a-zA-Z0-9\-_.!~*'():@&=+$,]+|(?:%[a-fA-F0-9][a-fA-F0-9]))*))*))*))(?:[?](?:(?:(?:[;/?:@&=+$,a-zA-Z0-9\-_.!~*'()]+|(?:%[a-fA-F0-9][a-fA-F0-9]))*)))?))?)
Ba-bow
After patching:
perl -e 'use Regexp::Common qw(URI); print "$RE{URI}{HTTP}\n"; if ("https://somesite.com/" =~ m/$RE{URI}{HTTP}/) { print "Success!\n" } else { print "Ba-bow\n" }'
(?:(?:https?)://(?:(?:(?:(?:(?:(?:[a-zA-Z0-9][-a-zA-Z0-9]*)?[a-zA-Z0-9])[.])*(?:[a-zA-Z][-a-zA-Z0-9]*[a-zA-Z0-9]|[a-zA-Z])[.]?)|(?:[0-9]+[.][0-9]+[.][0-9]+[.][0-9]+)))(?::(?:(?:[0-9]*)))?(?:/(?:(?:(?:(?:(?:(?:[a-zA-Z0-9\-_.!~*'():@&=+$,]+|(?:%[a-fA-F0-9][a-fA-F0-9]))*)(?:;(?:(?:[a-zA-Z0-9\-_.!~*'():@&=+$,]+|(?:%[a-fA-F0-9][a-fA-F0-9]))*))*)(?:/(?:(?:(?:[a-zA-Z0-9\-_.!~*'():@&=+$,]+|(?:%[a-fA-F0-9][a-fA-F0-9]))*)(?:;(?:(?:[a-zA-Z0-9\-_.!~*'():@&=+$,]+|(?:%[a-fA-F0-9][a-fA-F0-9]))*))*))*))(?:[?](?:(?:(?:[;/?:@&=+$,a-zA-Z0-9\-_.!~*'()]+|(?:%[a-fA-F0-9][a-fA-F0-9]))*)))?))?)
Success!
Subject: | Regexp-Common-URI-HTTP.patch |
--- URI/http.pm.orig 2014-01-29 16:39:02.409221757 +0000
+++ URI/http.pm 2014-01-29 16:39:18.111518424 +0000
@@ -21,7 +21,7 @@
pattern name => [qw (URI HTTP), "-scheme=http"],
create => sub {
my $scheme = $_ [1] -> {-scheme};
- my $uri = $http_uri;
+ my $uri = $https_uri;
$uri =~ s/http/$scheme/;
$uri;
}