1
0
mirror of https://github.com/moparisthebest/curl synced 2024-08-13 17:03:50 -04:00

getinfo: Fix return code for unknown CURLINFO options

- If a CURLINFO option is unknown return CURLE_UNKNOWN_OPTION.

Prior to this change CURLE_BAD_FUNCTION_ARGUMENT was returned on
unknown. That return value is contradicted by the CURLINFO option
documentation which specifies a return of CURLE_UNKNOWN_OPTION on
unknown.
This commit is contained in:
Jay Satiro 2015-10-01 16:39:40 -04:00
parent b1d55997e5
commit 69ea579700

View File

@ -113,7 +113,7 @@ static CURLcode getinfo_char(struct SessionHandle *data, CURLINFO info,
break; break;
default: default:
return CURLE_BAD_FUNCTION_ARGUMENT; return CURLE_UNKNOWN_OPTION;
} }
return CURLE_OK; return CURLE_OK;
@ -200,7 +200,7 @@ static CURLcode getinfo_long(struct SessionHandle *data, CURLINFO info,
break; break;
default: default:
return CURLE_BAD_FUNCTION_ARGUMENT; return CURLE_UNKNOWN_OPTION;
} }
return CURLE_OK; return CURLE_OK;
@ -253,7 +253,7 @@ static CURLcode getinfo_double(struct SessionHandle *data, CURLINFO info,
break; break;
default: default:
return CURLE_BAD_FUNCTION_ARGUMENT; return CURLE_UNKNOWN_OPTION;
} }
return CURLE_OK; return CURLE_OK;
@ -326,7 +326,7 @@ static CURLcode getinfo_slist(struct SessionHandle *data, CURLINFO info,
} }
break; break;
default: default:
return CURLE_BAD_FUNCTION_ARGUMENT; return CURLE_UNKNOWN_OPTION;
} }
return CURLE_OK; return CURLE_OK;
@ -351,7 +351,7 @@ static CURLcode getinfo_socket(struct SessionHandle *data, CURLINFO info,
*param_socketp = -1; *param_socketp = -1;
break; break;
default: default:
return CURLE_BAD_FUNCTION_ARGUMENT; return CURLE_UNKNOWN_OPTION;
} }
return CURLE_OK; return CURLE_OK;
@ -366,8 +366,7 @@ CURLcode Curl_getinfo(struct SessionHandle *data, CURLINFO info, ...)
struct curl_slist **param_slistp = NULL; struct curl_slist **param_slistp = NULL;
curl_socket_t *param_socketp = NULL; curl_socket_t *param_socketp = NULL;
int type; int type;
/* default return code is to error out! */ CURLcode result = CURLE_UNKNOWN_OPTION;
CURLcode result = CURLE_BAD_FUNCTION_ARGUMENT;
if(!data) if(!data)
return result; return result;