fix for trailing slash problem

proposed fix for trailing slash problem that retains check to avoid
baddomain attacks (ie: server.com.baddomain.com)

jg 3/18/2014
1. overwrote original change based on suggestions from @nshampur with the help of @afili and @esoekianto.
2. this fix ensure that we no longer check to enforce a particular protocol for requests (ie: http and https are both allowed.) 
3 also implements a check when matchAll is 'false' for a particular <serverUrl> for the first time.
4. added a step to decode encoded urls.