1--- 2c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al. 3SPDX-License-Identifier: curl 4Title: CURLOPT_PROXYAUTH 5Section: 3 6Source: libcurl 7See-also: 8 - CURLOPT_HTTPAUTH (3) 9 - CURLOPT_PROXY (3) 10 - CURLOPT_PROXYPORT (3) 11 - CURLOPT_PROXYTYPE (3) 12 - CURLOPT_PROXYUSERPWD (3) 13Protocol: 14 - All 15Added-in: 7.10.7 16--- 17 18# NAME 19 20CURLOPT_PROXYAUTH - HTTP proxy authentication methods 21 22# SYNOPSIS 23 24~~~c 25#include <curl/curl.h> 26 27CURLcode curl_easy_setopt(CURL *handle, CURLOPT_PROXYAUTH, long bitmask); 28~~~ 29 30# DESCRIPTION 31 32Pass a long as parameter, which is set to a bitmask, to tell libcurl which 33HTTP authentication method(s) you want it to use for your proxy 34authentication. If more than one bit is set, libcurl first queries the site to 35see what authentication methods it supports and then it picks the best one you 36allow it to use. For some methods, this induces an extra network round-trip. 37Set the actual name and password with the CURLOPT_PROXYUSERPWD(3) 38option. 39 40The bitmask can be constructed by the bits listed and described in the 41CURLOPT_HTTPAUTH(3) man page. 42 43# DEFAULT 44 45CURLAUTH_BASIC 46 47# %PROTOCOLS% 48 49# EXAMPLE 50 51~~~c 52int main(void) 53{ 54 CURL *curl = curl_easy_init(); 55 if(curl) { 56 CURLcode ret; 57 curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/"); 58 /* use this proxy */ 59 curl_easy_setopt(curl, CURLOPT_PROXY, "http://local.example.com:1080"); 60 /* allow whatever auth the proxy speaks */ 61 curl_easy_setopt(curl, CURLOPT_PROXYAUTH, CURLAUTH_ANY); 62 /* set the proxy credentials */ 63 curl_easy_setopt(curl, CURLOPT_PROXYUSERPWD, "james:007"); 64 ret = curl_easy_perform(curl); 65 curl_easy_cleanup(curl); 66 } 67} 68~~~ 69 70# %AVAILABILITY% 71 72# RETURN VALUE 73 74Returns CURLE_OK if the option is supported, CURLE_UNKNOWN_OPTION if not, or 75CURLE_NOT_BUILT_IN if the bitmask specified no supported authentication 76methods. 77