CURLOPT_PROXYAUTH.3 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. .\" generated by cd2nroff 0.1 from CURLOPT_PROXYAUTH.md
  2. .TH CURLOPT_PROXYAUTH 3 "2025-01-17" libcurl
  3. .SH NAME
  4. CURLOPT_PROXYAUTH \- HTTP proxy authentication methods
  5. .SH SYNOPSIS
  6. .nf
  7. #include <curl/curl.h>
  8. CURLcode curl_easy_setopt(CURL *handle, CURLOPT_PROXYAUTH, long bitmask);
  9. .fi
  10. .SH DESCRIPTION
  11. Pass a long as parameter, which is set to a bitmask, to tell libcurl which
  12. HTTP authentication method(s) you want it to use for your proxy
  13. authentication. If more than one bit is set, libcurl first queries the site to
  14. see what authentication methods it supports and then it picks the best one you
  15. allow it to use. For some methods, this induces an extra network round\-trip.
  16. Set the actual name and password with the \fICURLOPT_PROXYUSERPWD(3)\fP
  17. option.
  18. The bitmask can be constructed by the bits listed and described in the
  19. \fICURLOPT_HTTPAUTH(3)\fP man page.
  20. .SH DEFAULT
  21. CURLAUTH_BASIC
  22. .SH PROTOCOLS
  23. This functionality affects all supported protocols
  24. .SH EXAMPLE
  25. .nf
  26. int main(void)
  27. {
  28. CURL *curl = curl_easy_init();
  29. if(curl) {
  30. CURLcode ret;
  31. curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
  32. /* use this proxy */
  33. curl_easy_setopt(curl, CURLOPT_PROXY, "http://local.example.com:1080");
  34. /* allow whatever auth the proxy speaks */
  35. curl_easy_setopt(curl, CURLOPT_PROXYAUTH, CURLAUTH_ANY);
  36. /* set the proxy credentials */
  37. curl_easy_setopt(curl, CURLOPT_PROXYUSERPWD, "james:007");
  38. ret = curl_easy_perform(curl);
  39. curl_easy_cleanup(curl);
  40. }
  41. }
  42. .fi
  43. .SH AVAILABILITY
  44. Added in curl 7.10.7
  45. .SH RETURN VALUE
  46. Returns CURLE_OK if the option is supported, CURLE_UNKNOWN_OPTION if not, or
  47. CURLE_NOT_BUILT_IN if the bitmask specified no supported authentication
  48. methods.
  49. .SH SEE ALSO
  50. .BR CURLOPT_HTTPAUTH (3),
  51. .BR CURLOPT_PROXY (3),
  52. .BR CURLOPT_PROXYPORT (3),
  53. .BR CURLOPT_PROXYTYPE (3),
  54. .BR CURLOPT_PROXYUSERPWD (3)