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