Skip to content

Commit

Permalink
lib-http: server: Flush and check output for errors after uncorking.
Browse files Browse the repository at this point in the history
Otherwise, a disconnection event may be missed.
  • Loading branch information
stephanbosch committed Feb 17, 2018
1 parent e4b70fb commit e3666a5
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/lib-http/http-server-response.c
Expand Up @@ -684,8 +684,16 @@ static int http_server_response_send_real(struct http_server_response *resp,
http_server_response_finish_payload_out(resp);
}
}
if (!resp->payload_corked)
o_stream_uncork(output);
if (ret >= 0 && !resp->payload_corked &&
o_stream_uncork_flush(output) < 0) {
if (output->stream_errno != EPIPE &&
output->stream_errno != ECONNRESET) {
*error_r = t_strdup_printf("flush(%s) failed: %s",
o_stream_get_name(output),
o_stream_get_error(output));
}
ret = -1;
}
o_stream_unref(&output);
return ret;
}
Expand Down

0 comments on commit e3666a5

Please sign in to comment.