Subject: | ->httpurl generates invalid URL |
->httpurl method generates HTTP URLs such like:
http://voluptatem.example.com:2725natus/et/rerum
http://example.com:12481unde/explicabo/nulla
http://maxime.example.netdolores/minus/ut/in/reprehenderit
As you see, hostname and path are joined without "/". These are not
well-formed URL.
I wrote a tiny patch for fixing the issue. Please see attachment.
Regards,
Subject: | fix-httpurl.patch |
diff --git Makefile.PL Makefile.PL
index 3966216..6dce2af 100644
--- Makefile.PL
+++ Makefile.PL
@@ -20,6 +20,7 @@ resources repository => 'http://github.com/robertkrimen/text-lorem-more/tree/mas
{
map { my ($pk, $vr) = split m/\s/; build_requires $pk => $vr || 0 } grep { ! /^\s*#/ } split m/\n/, <<_END_;
+Data::Validate::URI
Test::Most
Test::More
_END_
diff --git lib/Text/Lorem/More.pm lib/Text/Lorem/More.pm
index 2969d1b..df15afb 100644
--- lib/Text/Lorem/More.pm
+++ lib/Text/Lorem/More.pm
@@ -230,8 +230,8 @@ _END_
path => sub { [ "+word", 1 + int rand 6, "/" ] },
httpurl => [ map { [ $_ ] } split m/\n/, <<_END_ ],
-http://+hostname+path
-http://+hostname:+port+path
+http://+hostname/+path
+http://+hostname:+port/+path
_END_
port => sub { int rand(1 + (2 ** 15)) },
diff --git t/9001-httpurl-generates-invalid-url.t t/9001-httpurl-generates-invalid-url.t
new file mode 100644
index 0000000..1d8f133
--- /dev/null
+++ t/9001-httpurl-generates-invalid-url.t
@@ -0,0 +1,15 @@
+#!/usr/bin/perl
+
+use strict;
+use warnings;
+
+use Test::More;
+
+use Data::Validate::URI qw/is_http_uri/;
+use Text::Lorem::More qw/lorem/;
+
+for (1 .. 2 ** 8) {
+ ok(is_http_uri(lorem->httpurl), 'Got a well-formed URL');
+}
+
+done_testing;