catch ECONNRESET
use chunked transfer encoding (do we need to write the length again or is that enough?)