Skip to content

Commit

Permalink
Fixed case-insensitive matching
Browse files Browse the repository at this point in the history
  • Loading branch information
punkrats committed Apr 30, 2011
1 parent 17fe940 commit 97571b5
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/vidibus/validate_uri/core.rb
Expand Up @@ -6,10 +6,10 @@ module ValidateUri
module Core

PORT_REGEXP = /(([:]\d+)?)/
DOMAIN_REGEXP = /([äüößa-z0-9\-]+\.?)*([äüößa-z0-9]{2,})\.([a-z]{2,}){1,2}/ # TODO: Add real IDN support
DOMAIN_REGEXP = /([äüößa-z0-9\-]+\.?)*([äüößa-z0-9]{2,})\.([a-z]{2,}){1,2}/i # TODO: Add real IDN support
IP_REGEXP = /(?>(?:1?\d?\d|2[0-4]\d|25[0-5])\.){3}(?:1?\d?\d|2[0-4]\d|25[0-5])(?:\/(?:[12]?\d|3[012])|-(?>(?:1?\d?\d|2[0-4]\d|25[0-5])\.){3}(?:1?\d?\d|2[0-4]\d|25[0-5]))?/
PATH_REGEXP = /(\/[a-z0-9\-_\.\,\/]*)?/
PARAMS_REGEXP = /\/?(\?[a-z0-9\-_\&=\|]*)?/
PATH_REGEXP = /(\/[a-z0-9\-_\.\,\/]*)?/i
PARAMS_REGEXP = /\/?(\?[a-z0-9\-_\&=\|]*)?/i
FRAGMENT_REGEXP = /(\#.*)?/

# Returns true if given URI is valid.
Expand Down
5 changes: 5 additions & 0 deletions spec/vidibus/validate_uri/core_spec.rb
Expand Up @@ -184,6 +184,11 @@ def in_test_environment(&block)
uri = "http://www.ali.baba.döner.de"
test.valid_uri?(uri).should be_true
end

it "should validate http://mydomain.local/WhatsUp" do
uri = "http://mydomain.local/WhatsUp"
test.valid_uri?(uri).should be_true
end
end

describe "#accessible_uri?" do
Expand Down

0 comments on commit 97571b5

Please sign in to comment.