be slightly smarter about replacing http