Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

secure-transport, fixes recv return code handling #10717

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions lib/vtls/sectransp.c
Original file line number Diff line number Diff line change
Expand Up @@ -3377,13 +3377,15 @@ static ssize_t sectransp_recv(struct Curl_cfilter *cf,
DEBUGASSERT(backend);

again:
*curlcode = CURLE_OK;
err = SSLRead(backend->ssl_ctx, buf, buffersize, &processed);

if(err != noErr) {
switch(err) {
case errSSLWouldBlock: /* return how much we read (if anything) */
if(processed)
if(processed) {
return (ssize_t)processed;
}
*curlcode = CURLE_AGAIN;
return -1L;
break;
Expand All @@ -3395,7 +3397,7 @@ static ssize_t sectransp_recv(struct Curl_cfilter *cf,
case errSSLClosedGraceful:
case errSSLClosedNoNotify:
*curlcode = CURLE_OK;
return -1L;
return 0;
bagder marked this conversation as resolved.
Show resolved Hide resolved
break;

/* The below is errSSLPeerAuthCompleted; it's not defined in
Expand All @@ -3406,8 +3408,10 @@ static ssize_t sectransp_recv(struct Curl_cfilter *cf,
CURLcode result = verify_cert(cf, data, conn_config->CAfile,
conn_config->ca_info_blob,
backend->ssl_ctx);
if(result)
return result;
if(result) {
*curlcode = result;
return -1;
}
}
goto again;
default:
Expand Down