aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/uri/ldap.rb1
-rw-r--r--test/uri/test_ldap.rb4
2 files changed, 5 insertions, 0 deletions
diff --git a/lib/uri/ldap.rb b/lib/uri/ldap.rb
index a2043ccdf5..14e6163292 100644
--- a/lib/uri/ldap.rb
+++ b/lib/uri/ldap.rb
@@ -118,6 +118,7 @@ module URI
# Private method to cleanup +dn+ from using the +path+ component attribute.
def parse_dn
+ raise InvalidURIError, 'bad LDAP URL' unless @path
@dn = @path[1..-1]
end
private :parse_dn
diff --git a/test/uri/test_ldap.rb b/test/uri/test_ldap.rb
index adad4454b5..64845e487a 100644
--- a/test/uri/test_ldap.rb
+++ b/test/uri/test_ldap.rb
@@ -95,6 +95,10 @@ class TestLDAP < Test::Unit::TestCase
u.select(:scheme, :host, :not_exist, :port)
end
end
+
+ def test_parse_invalid_uri
+ assert_raise(URI::InvalidURIError) {URI.parse("ldap:https://example.com")}
+ end
end