1--- 2c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al. 3SPDX-License-Identifier: curl 4Title: CURLINFO_PROXYAUTH_USED 5Section: 3 6Source: libcurl 7See-also: 8 - CURLINFO_HTTPAUTH_USED (3) 9 - CURLINFO_PROXYAUTH_AVAIL (3) 10 - CURLOPT_HTTPAUTH (3) 11Protocol: 12 - HTTP 13Added-in: 8.12.0 14--- 15 16# NAME 17 18CURLINFO_PROXYAUTH_USED - get used HTTP proxy authentication method 19 20# SYNOPSIS 21 22~~~c 23#include <curl/curl.h> 24 25CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_PROXYAUTH_USED, long *authp); 26~~~ 27 28# DESCRIPTION 29 30Pass a pointer to a long to receive a bitmask indicating the authentication 31method that was used in the previous request done over an HTTP proxy. The 32meaning of the possible bits is explained in the CURLOPT_HTTPAUTH(3) option 33for curl_easy_setopt(3). 34 35The returned value has zero or one bit set. 36 37# %PROTOCOLS% 38 39# EXAMPLE 40 41~~~c 42int main(void) 43{ 44 CURL *curl = curl_easy_init(); 45 if(curl) { 46 CURLcode res; 47 curl_easy_setopt(curl, CURLOPT_URL, "https://example.com"); 48 curl_easy_setopt(curl, CURLOPT_PROXY, "http://proxy.example.com"); 49 curl_easy_setopt(curl, CURLOPT_PROXYAUTH, 50 CURLAUTH_BASIC | CURLAUTH_DIGEST); 51 curl_easy_setopt(curl, CURLOPT_PROXYUSERNAME, "shrek"); 52 curl_easy_setopt(curl, CURLOPT_PROXYPASSWORD, "swamp"); 53 54 res = curl_easy_perform(curl); 55 56 if(!res) { 57 long auth; 58 res = curl_easy_getinfo(curl, CURLINFO_PROXYAUTH_USED, &auth); 59 if(!res) { 60 if(!auth) 61 printf("No auth used\n"); 62 else { 63 if(auth == CURLAUTH_DIGEST) 64 printf("Used Digest proxy authentication\n"); 65 else 66 printf("Used Basic proxy authentication\n"); 67 } 68 } 69 } 70 curl_easy_cleanup(curl); 71 } 72} 73~~~ 74 75# %AVAILABILITY% 76 77# RETURN VALUE 78 79curl_easy_getinfo(3) returns a CURLcode indicating success or error. 80 81CURLE_OK (0) means everything was OK, non-zero means an error occurred, see 82libcurl-errors(3). 83