[bug 1081413] URL validation code edits, additions, and test

Added and edited url validation code and created a test for it.