1--- 2c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al. 3SPDX-License-Identifier: curl 4Title: CURLINFO_USED_PROXY 5Section: 3 6Source: libcurl 7See-also: 8 - CURLOPT_NOPROXY (3) 9 - CURLOPT_PROXY (3) 10 - curl_easy_getinfo (3) 11 - curl_easy_setopt (3) 12Protocol: 13 - All 14--- 15 16# NAME 17 18CURLINFO_USED_PROXY - whether the transfer used a proxy 19 20# SYNOPSIS 21 22~~~c 23#include <curl/curl.h> 24 25CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_USED_PROXY, 26 long *authp); 27~~~ 28 29# DESCRIPTION 30 31Pass a pointer to a long. It gets set to zero set if no proxy was used in the 32previous transfer or a non-zero value if a proxy was used. 33 34# EXAMPLE 35 36~~~c 37int main(int argc, char *argv[]) 38{ 39 CURL *curl = curl_easy_init(); 40 if(curl) { 41 CURLcode res; 42 curl_easy_setopt(curl, CURLOPT_URL, argv[1]); 43 curl_easy_setopt(curl, CURLOPT_PROXY, "http://127.0.0.1:80"); 44 curl_easy_setopt(curl, CURLOPT_NOPROXY, "example.com"); 45 46 res = curl_easy_perform(curl); 47 48 if(!res) { 49 /* extract the available proxy authentication types */ 50 long used; 51 res = curl_easy_getinfo(curl, CURLINFO_USED_PROXY, &used); 52 if(!res) { 53 printf("The proxy was %sused\n", used ? "": "NOT "); 54 } 55 } 56 curl_easy_cleanup(curl); 57 } 58} 59~~~ 60 61# AVAILABILITY 62 63Added in 8.7.0 64 65# RETURN VALUE 66 67Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. 68