You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

28 lines
1.3 KiB

diff --git b/lib/gnutls_handshake.c a/lib/gnutls_handshake.c
index 5930941..e904f2e 100644
--- b/lib/gnutls_handshake.c
+++ a/lib/gnutls_handshake.c
@@ -2510,7 +2510,8 @@ static int _gnutls_recv_supplemental(gnutls_session_t session)
* are non fatal errors, only in the specific case of a rehandshake.
* Their meaning is that the client rejected the rehandshake request or
* in the case of %GNUTLS_E_GOT_APPLICATION_DATA it could also mean that
- * some data were pending.
+ * some data were pending. A client may receive that error code if
+ * it initiates the handshake and the server doesn't agreed.
*
* Returns: %GNUTLS_E_SUCCESS on success, otherwise a negative error code.
**/
diff --git b/lib/gnutls_record.c a/lib/gnutls_record.c
index 157d12a..40c20fe 100644
--- b/lib/gnutls_record.c
+++ a/lib/gnutls_record.c
@@ -837,7 +837,7 @@ record_add_to_buffers(gnutls_session_t session,
* reasons). Otherwise it is an unexpected packet
*/
if (type == GNUTLS_ALERT
- || (htype == GNUTLS_HANDSHAKE_CLIENT_HELLO
+ || ((htype == GNUTLS_HANDSHAKE_SERVER_HELLO || htype == GNUTLS_HANDSHAKE_CLIENT_HELLO)
&& type == GNUTLS_HANDSHAKE)) {
/* even if data is unexpected put it into the buffer */
_gnutls_record_buffer_put(session, recv->type,