diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2019-11-05 12:08:17 +0000 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2019-11-05 12:08:17 +0000 |
commit | a2af525bbd71f141eafadb78fa8ac8e76788bee6 (patch) | |
tree | 47bf9fcea2582cad3dcfd05c53d260c941b34ece /src/libutil | |
parent | 1ee4b159437edc1d991860008371f587c3283cda (diff) | |
download | rspamd-a2af525bbd71f141eafadb78fa8ac8e76788bee6.tar.gz rspamd-a2af525bbd71f141eafadb78fa8ac8e76788bee6.zip |
[Fix] Check results of write message as SSL can bork them
Diffstat (limited to 'src/libutil')
-rw-r--r-- | src/libutil/http_connection.c | 22 | ||||
-rw-r--r-- | src/libutil/http_connection.h | 4 |
2 files changed, 14 insertions, 12 deletions
diff --git a/src/libutil/http_connection.c b/src/libutil/http_connection.c index f7da1ee83..ca87c205a 100644 --- a/src/libutil/http_connection.c +++ b/src/libutil/http_connection.c @@ -1195,7 +1195,7 @@ rspamd_http_connection_new_client (struct rspamd_http_context *ctx, if (fd == -1) { msg_info ("cannot connect to http proxy %s: %s", - rspamd_inet_address_to_string (proxy_addr), + rspamd_inet_address_to_string_pretty (proxy_addr), strerror (errno)); rspamd_upstream_fail (up, TRUE); @@ -1214,8 +1214,8 @@ rspamd_http_connection_new_client (struct rspamd_http_context *ctx, fd = rspamd_inet_address_connect (addr, SOCK_STREAM, TRUE); if (fd == -1) { - msg_info ("cannot connect to proxy %s: %s", - rspamd_inet_address_to_string (addr), + msg_info ("cannot connect make http connection to %s: %s", + rspamd_inet_address_to_string_pretty (addr), strerror (errno)); return NULL; @@ -1905,7 +1905,7 @@ rspamd_http_message_write_header (const gchar* mime_type, gboolean encrypted, return meth_len; } -static void +static gboolean rspamd_http_connection_write_message_common (struct rspamd_http_connection *conn, struct rspamd_http_message *msg, const gchar *host, @@ -2236,7 +2236,7 @@ rspamd_http_connection_write_message_common (struct rspamd_http_connection *conn conn->error_handler (conn, err); rspamd_http_connection_unref (conn); g_error_free (err); - return; + return FALSE; } else { if (priv->ssl) { @@ -2261,7 +2261,7 @@ rspamd_http_connection_write_message_common (struct rspamd_http_connection *conn conn->error_handler (conn, err); rspamd_http_connection_unref (conn); g_error_free (err); - return; + return FALSE; } } } @@ -2270,9 +2270,11 @@ rspamd_http_connection_write_message_common (struct rspamd_http_connection *conn rspamd_http_event_handler, conn); rspamd_ev_watcher_start (priv->ctx->event_loop, &priv->ev, priv->timeout); } + + return TRUE; } -void +gboolean rspamd_http_connection_write_message (struct rspamd_http_connection *conn, struct rspamd_http_message *msg, const gchar *host, @@ -2280,11 +2282,11 @@ rspamd_http_connection_write_message (struct rspamd_http_connection *conn, gpointer ud, ev_tstamp timeout) { - rspamd_http_connection_write_message_common (conn, msg, host, mime_type, + return rspamd_http_connection_write_message_common (conn, msg, host, mime_type, ud, timeout, FALSE); } -void +gboolean rspamd_http_connection_write_message_shared (struct rspamd_http_connection *conn, struct rspamd_http_message *msg, const gchar *host, @@ -2292,7 +2294,7 @@ rspamd_http_connection_write_message_shared (struct rspamd_http_connection *conn gpointer ud, ev_tstamp timeout) { - rspamd_http_connection_write_message_common (conn, msg, host, mime_type, + return rspamd_http_connection_write_message_common (conn, msg, host, mime_type, ud, timeout, TRUE); } diff --git a/src/libutil/http_connection.h b/src/libutil/http_connection.h index b90d0125a..7c901fd2a 100644 --- a/src/libutil/http_connection.h +++ b/src/libutil/http_connection.h @@ -240,7 +240,7 @@ void rspamd_http_connection_read_message_shared ( * @param ud opaque user data * @param fd fd to read/write */ -void rspamd_http_connection_write_message ( +gboolean rspamd_http_connection_write_message ( struct rspamd_http_connection *conn, struct rspamd_http_message *msg, const gchar *host, @@ -248,7 +248,7 @@ void rspamd_http_connection_write_message ( gpointer ud, ev_tstamp timeout); -void rspamd_http_connection_write_message_shared ( +gboolean rspamd_http_connection_write_message_shared ( struct rspamd_http_connection *conn, struct rspamd_http_message *msg, const gchar *host, |