http: check if a response has already been sent before sending a 500