HTTP_CLIENT_REQUEST_ERROR_CONNECTION_LOST, error);
}
+void http_client_connection_handle_output_error(
+ struct http_client_connection *conn)
+{
+ struct ostream *output = conn->conn.output;
+
+ if (output->stream_errno != EPIPE &&
+ output->stream_errno != ECONNRESET) {
+ http_client_connection_lost(&conn,
+ t_strdup_printf("write(%s) failed: %s",
+ o_stream_get_name(output),
+ o_stream_get_error(output)));
+ } else {
+ http_client_connection_lost(&conn,
+ "Remote disconnected");
+ }
+}
+
int http_client_connection_check_ready(struct http_client_connection *conn)
{
const struct http_client_settings *set = &conn->peer->client->set;
http_client_connection_reset_request_timeout(conn);
if ((ret = o_stream_flush(output)) <= 0) {
- if (ret < 0) {
- http_client_connection_lost(&conn,
- t_strdup_printf("write(%s) failed: %s",
- o_stream_get_name(output),
- o_stream_get_error(output)));
- }
+ if (ret < 0)
+ http_client_connection_handle_output_error(conn);
return ret;
}
void http_client_connection_request_destroyed(
struct http_client_connection *conn, struct http_client_request *req);
+void http_client_connection_handle_output_error(
+ struct http_client_connection *conn);
int http_client_connection_output(struct http_client_connection *conn);
void http_client_connection_start_request_timeout(
struct http_client_connection *conn);