1--- 2c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al. 3SPDX-License-Identifier: curl 4Title: CURLINFO_PROXY_ERROR 5Section: 3 6Source: libcurl 7See-also: 8 - CURLINFO_RESPONSE_CODE (3) 9 - curl_easy_getinfo (3) 10 - curl_easy_setopt (3) 11 - libcurl-errors (3) 12Protocol: 13 - All 14Added-in: 7.73.0 15--- 16 17# NAME 18 19CURLINFO_PROXY_ERROR - get the detailed (SOCKS) proxy error 20 21# SYNOPSIS 22 23~~~c 24#include <curl/curl.h> 25 26typedef enum { 27 CURLPX_OK, 28 CURLPX_BAD_ADDRESS_TYPE, 29 CURLPX_BAD_VERSION, 30 CURLPX_CLOSED, 31 CURLPX_GSSAPI, 32 CURLPX_GSSAPI_PERMSG, 33 CURLPX_GSSAPI_PROTECTION, 34 CURLPX_IDENTD, 35 CURLPX_IDENTD_DIFFER, 36 CURLPX_LONG_HOSTNAME, 37 CURLPX_LONG_PASSWD, 38 CURLPX_LONG_USER, 39 CURLPX_NO_AUTH, 40 CURLPX_RECV_ADDRESS, 41 CURLPX_RECV_AUTH, 42 CURLPX_RECV_CONNECT, 43 CURLPX_RECV_REQACK, 44 CURLPX_REPLY_ADDRESS_TYPE_NOT_SUPPORTED, 45 CURLPX_REPLY_COMMAND_NOT_SUPPORTED, 46 CURLPX_REPLY_CONNECTION_REFUSED, 47 CURLPX_REPLY_GENERAL_SERVER_FAILURE, 48 CURLPX_REPLY_HOST_UNREACHABLE, 49 CURLPX_REPLY_NETWORK_UNREACHABLE, 50 CURLPX_REPLY_NOT_ALLOWED, 51 CURLPX_REPLY_TTL_EXPIRED, 52 CURLPX_REPLY_UNASSIGNED, 53 CURLPX_REQUEST_FAILED, 54 CURLPX_RESOLVE_HOST, 55 CURLPX_SEND_AUTH, 56 CURLPX_SEND_CONNECT, 57 CURLPX_SEND_REQUEST, 58 CURLPX_UNKNOWN_FAIL, 59 CURLPX_UNKNOWN_MODE, 60 CURLPX_USER_REJECTED, 61 CURLPX_LAST /* never use */ 62} CURLproxycode; 63 64CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_PROXY_ERROR, long *detail); 65~~~ 66 67# DESCRIPTION 68 69Pass a pointer to a long to receive a detailed error code when the most recent 70transfer returned a **CURLE_PROXY** error. That error code matches the 71**CURLproxycode** set. 72 73The error code is zero (**CURLPX_OK**) if no response code was available. 74 75# %PROTOCOLS% 76 77# EXAMPLE 78 79~~~c 80int main(void) 81{ 82 CURL *curl = curl_easy_init(); 83 if(curl) { 84 CURLcode res; 85 curl_easy_setopt(curl, CURLOPT_URL, "https://example.com"); 86 87 curl_easy_setopt(curl, CURLOPT_PROXY, "socks5://127.0.0.1"); 88 res = curl_easy_perform(curl); 89 if(res == CURLE_PROXY) { 90 long proxycode; 91 res = curl_easy_getinfo(curl, CURLINFO_PROXY_ERROR, &proxycode); 92 if(!res && proxycode) 93 printf("The detailed proxy error: %ld\n", proxycode); 94 } 95 curl_easy_cleanup(curl); 96 } 97} 98~~~ 99 100# %AVAILABILITY% 101 102# RETURN VALUE 103 104Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. 105