refine code, extract protocol uri.