CURLINFO_USED_PROXY.3 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. .\" generated by cd2nroff 0.1 from CURLINFO_USED_PROXY.md
  2. .TH CURLINFO_USED_PROXY 3 "2025-01-17" libcurl
  3. .SH NAME
  4. CURLINFO_USED_PROXY \- whether the transfer used a proxy
  5. .SH SYNOPSIS
  6. .nf
  7. #include <curl/curl.h>
  8. CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_USED_PROXY,
  9. long *authp);
  10. .fi
  11. .SH DESCRIPTION
  12. Pass a pointer to a long. It gets set to zero set if no proxy was used in the
  13. previous transfer or a non\-zero value if a proxy was used.
  14. .SH PROTOCOLS
  15. This functionality affects all supported protocols
  16. .SH EXAMPLE
  17. .nf
  18. int main(int argc, char *argv[])
  19. {
  20. CURL *curl = curl_easy_init();
  21. if(curl) {
  22. CURLcode res;
  23. curl_easy_setopt(curl, CURLOPT_URL, argv[1]);
  24. curl_easy_setopt(curl, CURLOPT_PROXY, "http://127.0.0.1:80");
  25. curl_easy_setopt(curl, CURLOPT_NOPROXY, "example.com");
  26. res = curl_easy_perform(curl);
  27. if(!res) {
  28. /* extract the available proxy authentication types */
  29. long used;
  30. res = curl_easy_getinfo(curl, CURLINFO_USED_PROXY, &used);
  31. if(!res) {
  32. printf("The proxy was %sused\\n", used ? "": "NOT ");
  33. }
  34. }
  35. curl_easy_cleanup(curl);
  36. }
  37. }
  38. .fi
  39. .SH AVAILABILITY
  40. Added in curl 8.7.0
  41. .SH RETURN VALUE
  42. Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not.
  43. .SH SEE ALSO
  44. .BR CURLOPT_NOPROXY (3),
  45. .BR CURLOPT_PROXY (3),
  46. .BR curl_easy_getinfo (3),
  47. .BR curl_easy_setopt (3)