improved url validation: prefix or suffix blank string of the url now is trimed.

Hi  there, 
   we met a problem that some urls with 'prefix blanks' will be mark as invalid. e.g.:

" http://google.com/   "  is not valid.
   
  So I make this commit, please review my code.

Best Regards,
Angela Wang