Under Python 3.7 at least, the split of the port field fails ungracefully if there is no slash. The fix also addresses the case of an empty protocol after the slash.