Base: Improve URL detection code