diff -r e3bc99a4a6bd -r c10d4343a17f mutt_ssl_gnutls.c --- a/mutt_ssl_gnutls.c Tue Mar 11 17:20:48 2008 -0700 +++ b/mutt_ssl_gnutls.c Thu Apr 03 17:08:13 2008 +0200 @@ -112,6 +112,7 @@ static int tls_socket_write (CONNECTION* { tlssockdata *data = conn->sockdata; int ret; + size_t sent = 0; if (!data) { @@ -120,14 +121,23 @@ static int tls_socket_write (CONNECTION* return -1; } - ret = gnutls_record_send (data->state, buf, len); - if (ret < 0 && gnutls_error_is_fatal(ret) == 1) + do { - mutt_error ("tls_socket_write (%s)", gnutls_strerror (ret)); - mutt_sleep (4); - return -1; - } - return ret; + ret = gnutls_record_send (data->state, buf + sent, len - sent); + if (ret < 0) + { + if (gnutls_error_is_fatal(ret) == 1) + { + mutt_error ("tls_socket_write (%s)", gnutls_strerror (ret)); + mutt_sleep (4); + return -1; + } + return ret; + } + sent += ret; + } while (sent < len); + + return sent; } static int tls_socket_open (CONNECTION* conn)