- Improved Curl_read() to not ignore the error returned from Curl_ssl_recv().
This commit is contained in:
parent
6728334edb
commit
19ca0c0fbe
3
CHANGES
3
CHANGES
@ -6,6 +6,9 @@
|
|||||||
|
|
||||||
Changelog
|
Changelog
|
||||||
|
|
||||||
|
Kamil Dudka (19 Mar 2010)
|
||||||
|
- Improved Curl_read() to not ignore the error returned from Curl_ssl_recv().
|
||||||
|
|
||||||
Daniel Stenberg (15 Mar 2010)
|
Daniel Stenberg (15 Mar 2010)
|
||||||
- Constantine Sapuntzakis brought a patch:
|
- Constantine Sapuntzakis brought a patch:
|
||||||
|
|
||||||
|
@ -538,9 +538,11 @@ int Curl_read(struct connectdata *conn, /* connection data */
|
|||||||
if(conn->ssl[num].state == ssl_connection_complete) {
|
if(conn->ssl[num].state == ssl_connection_complete) {
|
||||||
nread = Curl_ssl_recv(conn, num, buffertofill, bytesfromsocket);
|
nread = Curl_ssl_recv(conn, num, buffertofill, bytesfromsocket);
|
||||||
|
|
||||||
if(nread == -1) {
|
if(nread == -1)
|
||||||
return -1; /* -1 from Curl_ssl_recv() means EWOULDBLOCK */
|
return -1; /* -1 from Curl_ssl_recv() means EWOULDBLOCK */
|
||||||
}
|
else if(nread == -2)
|
||||||
|
/* -2 from Curl_ssl_recv() means a true error, not EWOULDBLOCK */
|
||||||
|
return CURLE_RECV_ERROR;
|
||||||
}
|
}
|
||||||
else if(Curl_ssh_enabled(conn, (PROT_SCP|PROT_SFTP))) {
|
else if(Curl_ssh_enabled(conn, (PROT_SCP|PROT_SFTP))) {
|
||||||
if(conn->protocol & PROT_SCP)
|
if(conn->protocol & PROT_SCP)
|
||||||
|
10
lib/sslgen.c
10
lib/sslgen.c
@ -399,7 +399,7 @@ struct curl_slist *Curl_ssl_engines_list(struct SessionHandle *data)
|
|||||||
return curlssl_engines_list(data);
|
return curlssl_engines_list(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* return number of sent (non-SSL) bytes */
|
/* return number of sent (non-SSL) bytes; -1 on error */
|
||||||
ssize_t Curl_ssl_send(struct connectdata *conn,
|
ssize_t Curl_ssl_send(struct connectdata *conn,
|
||||||
int sockindex,
|
int sockindex,
|
||||||
const void *mem,
|
const void *mem,
|
||||||
@ -411,8 +411,8 @@ ssize_t Curl_ssl_send(struct connectdata *conn,
|
|||||||
/* return number of received (decrypted) bytes */
|
/* return number of received (decrypted) bytes */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If the read would block (EWOULDBLOCK) we return -1. Otherwise we return
|
* If the read would block (EWOULDBLOCK) we return -1. If an error occurs during
|
||||||
* a regular CURLcode value.
|
* the read, we return -2. Otherwise we return the count of bytes transfered.
|
||||||
*/
|
*/
|
||||||
ssize_t Curl_ssl_recv(struct connectdata *conn, /* connection data */
|
ssize_t Curl_ssl_recv(struct connectdata *conn, /* connection data */
|
||||||
int sockindex, /* socketindex */
|
int sockindex, /* socketindex */
|
||||||
@ -425,9 +425,9 @@ ssize_t Curl_ssl_recv(struct connectdata *conn, /* connection data */
|
|||||||
nread = curlssl_recv(conn, sockindex, mem, len, &block);
|
nread = curlssl_recv(conn, sockindex, mem, len, &block);
|
||||||
if(nread == -1) {
|
if(nread == -1) {
|
||||||
if(!block)
|
if(!block)
|
||||||
return 0; /* this is a true error, not EWOULDBLOCK */
|
return -2; /* this is a true error, not EWOULDBLOCK */
|
||||||
else
|
else
|
||||||
return -1;
|
return -1; /* EWOULDBLOCK */
|
||||||
}
|
}
|
||||||
|
|
||||||
return nread;
|
return nread;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user