added safe_host configuration; improved url parcing