Skip to content

Commit d435bff

Browse files
committed
Mirror GNU TLS handshake fix (Issue #1508)
1 parent 1003ac4 commit d435bff

1 file changed

Lines changed: 21 additions & 8 deletions

File tree

cups/tls-gnutls.c

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1221,12 +1221,12 @@ _httpTLSRead(http_t *http, /* I - Connection to server */
12211221
break;
12221222

12231223
case GNUTLS_E_AGAIN :
1224-
errno = EAGAIN;
1225-
break;
1224+
errno = EAGAIN;
1225+
break;
12261226

12271227
default :
1228-
errno = EPIPE;
1229-
break;
1228+
errno = EPIPE;
1229+
break;
12301230
}
12311231

12321232
result = -1;
@@ -1682,12 +1682,25 @@ _httpTLSWrite(http_t *http, /* I - Connection to server */
16821682
break;
16831683

16841684
case GNUTLS_E_AGAIN :
1685-
errno = EAGAIN;
1686-
break;
1685+
errno = EAGAIN;
1686+
break;
1687+
1688+
case GNUTLS_E_REHANDSHAKE :
1689+
// If used in client, ignore the error and try to read again...
1690+
if (http->mode == _HTTP_MODE_CLIENT)
1691+
{
1692+
errno = EAGAIN;
1693+
}
1694+
else
1695+
{
1696+
// Terminate the session as server...
1697+
errno = EPIPE;
1698+
}
1699+
break;
16871700

16881701
default :
1689-
errno = EPIPE;
1690-
break;
1702+
errno = EPIPE;
1703+
break;
16911704
}
16921705

16931706
result = -1;

0 commit comments

Comments
 (0)