fix for trailing slash problem

proposed fix for trailing slash problem that retains check to avoid
baddomain attacks (ie: server.com.baddomain.com)
fix for url comparisons
added code comments
need to split on '?' too
Merge pull request #27 from jgravois/master

fix for trailing slash problem