Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Curl with Cyassl and curl_multi_socket_action #2759

@jiandong1997

Description

@jiandong1997

I did this

Hi Guys,
I used the curl_multi_socket_action to drive the execution of curl library with cyassl. but I find socket always be closed before tls_connect is finished. Below is the callstack:
#0 Curl_ssl_getsock (conn=0x1007be28, socks=0xbffff8bc, numsocks=5) at vtls/vtls.c:519
#1 0xb7d69ce0 in https_getsock (conn=0x1007be28, socks=0xbffff8bc, numsocks=5) at http.c:1412
#2 0xb7d85468 in Curl_protocol_getsock (conn=0x1007be28, socks=0xbffff8bc, numsocks=5) at url.c:3858
#3 0xb7da9388 in multi_getsock (data=0x10073248, socks=0xbffff8bc, numsocks=5) at multi.c:899
#4 0xb7dac37c in singlesocket (multi=0x10017170, data=0x10073248) at multi.c:2325
#5 0xb7dacd64 in multi_socket (multi=0x10017170, checkall=false, s=-1, ev_bitmask=0, running_handles=0x100168f8 <curlm+8>) at multi.c:2651
#6 0xb7dad518 in curl_multi_socket_action (multi=0x10017170, s=-1, ev_bitmask=0, running_handles=0x100168f8 <curlm+8>) at multi.c:2752
#7 0x100027ac in curl_schedule () at abloy_curl.c:298
#8 0x10002100 in curl_drive (op=0x100168f0 ) at abloy_curl.c:192
...

After I changed the code like below, everything goes well.
+++ curl-7.52.1/lib/vtls/vtls.c 2018-07-12 16:31:40.462058075 -0700
@@ -485,7 +485,7 @@ void Curl_ssl_close_all(struct Curl_easy
}

#if defined(USE_SSLEAY) || defined(USE_GNUTLS) || defined(USE_SCHANNEL) || \

  • defined(USE_DARWINSSL) || defined(USE_NSS)
  • defined(USE_DARWINSSL) || defined(USE_NSS) || defined(USE_CYASSL)
    /* This function is for OpenSSL, GnuTLS, darwinssl, and schannel only. */
    int Curl_ssl_getsock(struct connectdata *conn, curl_socket_t *socks,
    int numsocks)

But I am not sure if the fix is correct.

I expected the following

curl/libcurl version

curl-7.52.1

[curl -V output]
~ # ./curl -V
curl 7.52.1 (powerpc-fsl-linux-gnu) libcurl/7.52.1 wolfSSL/3.6.8
Protocols: dict file ftp ftps gopher http https imap imaps pop3 pop3s rtsp smtp smtps telnet tftp
Features: Debug TrackMemory IPv6 Largefile SSL UnixSockets
~ #

operating system

Linux 3.12.19-rt30

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions