Fix URL parser bug. Also use http connection header to see if the socket is closed and we need another one, and hope it is accurate, since there appears to be no sensible way to get the connection state from ifSocket...