Malformed URIs were not being checked and were causing a deadlock to occur.