mirror of
https://github.com/moparisthebest/curl
synced 2025-03-11 07:39:50 -04:00
getinfo: CURLINFO_ACTIVESOCKET: fix bad socket value
- Set user info param to the socket returned by Curl_getconnectinfo, regardless of if the socket is bad. Effectively this means the user info param now will receive CURL_SOCKET_BAD instead of -1 on bad socket. - Remove incorrect comments. CURLINFO_ACTIVESOCKET is documented to write CURL_SOCKET_BAD to user info param but prior to this change it wrote -1. Bug: https://github.com/bagder/curl/pull/518 Reported-by: Marcel Raad
This commit is contained in:
parent
f6fbbd6dc3
commit
cd3aba1a5c
@ -335,20 +335,9 @@ static CURLcode getinfo_slist(struct SessionHandle *data, CURLINFO info,
|
|||||||
static CURLcode getinfo_socket(struct SessionHandle *data, CURLINFO info,
|
static CURLcode getinfo_socket(struct SessionHandle *data, CURLINFO info,
|
||||||
curl_socket_t *param_socketp)
|
curl_socket_t *param_socketp)
|
||||||
{
|
{
|
||||||
curl_socket_t sockfd;
|
|
||||||
|
|
||||||
switch(info) {
|
switch(info) {
|
||||||
case CURLINFO_ACTIVESOCKET:
|
case CURLINFO_ACTIVESOCKET:
|
||||||
sockfd = Curl_getconnectinfo(data, NULL);
|
*param_socketp = Curl_getconnectinfo(data, NULL);
|
||||||
|
|
||||||
/* note: this is not a good conversion for systems with 64 bit sockets and
|
|
||||||
32 bit longs */
|
|
||||||
if(sockfd != CURL_SOCKET_BAD)
|
|
||||||
*param_socketp = sockfd;
|
|
||||||
else
|
|
||||||
/* this interface is documented to return -1 in case of badness, which
|
|
||||||
may not be the same as the CURL_SOCKET_BAD value */
|
|
||||||
*param_socketp = -1;
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
return CURLE_UNKNOWN_OPTION;
|
return CURLE_UNKNOWN_OPTION;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user