secure URL parser for different ruby version