aboutsummaryrefslogtreecommitdiff
path: root/lib/gtls.c
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2006-05-04 06:00:40 +0000
committerDaniel Stenberg <daniel@haxx.se>2006-05-04 06:00:40 +0000
commit758f6eed5169f20635c410077b840c1ffb741ddb (patch)
tree21f4ecfc8c79c10bd12b2bc7f09399fc30376298 /lib/gtls.c
parent80ee5d3bd82343dc7064e6754032690d8b6887b2 (diff)
Mark Eichin submitted bug report #1480821
(http://curl.haxx.se/bug/view.cgi?id=1480821) He found and identified a problem with how libcurl dealt with GnuTLS and a case where gnutls returned GNUTLS_E_AGAIN indicating it would block. It would then return an unexpected return code, making Curl_ssl_send() confuse the upper layer - causing random 28 bytes trash data to get inserted in the transfered stream. The proper fix was to make the Curl_gtls_send() function return the proper return codes that the callers would expect. The Curl_ossl_send() function already did this.
Diffstat (limited to 'lib/gtls.c')
-rw-r--r--lib/gtls.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/gtls.c b/lib/gtls.c
index 5d3959cce..4cf78080b 100644
--- a/lib/gtls.c
+++ b/lib/gtls.c
@@ -458,6 +458,12 @@ int Curl_gtls_send(struct connectdata *conn,
int rc;
rc = gnutls_record_send(conn->ssl[sockindex].session, mem, len);
+ if(rc < 0 ) {
+ if(rc == GNUTLS_E_AGAIN)
+ return 0; /* EWOULDBLOCK equivalent */
+ rc = -1; /* generic error code for send failure */
+ }
+
return rc;
}