CURLOPT_PROXYHEADER.3 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. .\" generated by cd2nroff 0.1 from CURLOPT_PROXYHEADER.md
  2. .TH CURLOPT_PROXYHEADER 3 "2025-01-17" libcurl
  3. .SH NAME
  4. CURLOPT_PROXYHEADER \- set of HTTP headers to pass to proxy
  5. .SH SYNOPSIS
  6. .nf
  7. #include <curl/curl.h>
  8. CURLcode curl_easy_setopt(CURL *handle, CURLOPT_PROXYHEADER,
  9. struct curl_slist *headers);
  10. .fi
  11. .SH DESCRIPTION
  12. Pass a pointer to a linked list of HTTP headers to pass in your HTTP request
  13. sent to a proxy. The rules for this list is identical to the
  14. \fICURLOPT_HTTPHEADER(3)\fP option\(aqs.
  15. The headers set with this option is only ever used in requests sent to a proxy
  16. - when there is also a request sent to a host.
  17. The first line in a request (containing the method, usually a GET or POST) is
  18. NOT a header and cannot be replaced using this option. Only the lines
  19. following the request\-line are headers. Adding this method line in this list
  20. of headers causes your request to send an invalid header.
  21. Pass a NULL to this to reset back to no custom headers.
  22. .SH DEFAULT
  23. NULL
  24. .SH PROTOCOLS
  25. This functionality affects all supported protocols
  26. .SH EXAMPLE
  27. .nf
  28. int main(void)
  29. {
  30. CURL *curl = curl_easy_init();
  31. struct curl_slist *list;
  32. if(curl) {
  33. curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
  34. curl_easy_setopt(curl, CURLOPT_PROXY, "http://proxy.example.com:80");
  35. list = curl_slist_append(NULL, "Shoesize: 10");
  36. list = curl_slist_append(list, "Accept:");
  37. curl_easy_setopt(curl, CURLOPT_PROXYHEADER, list);
  38. curl_easy_perform(curl);
  39. curl_slist_free_all(list); /* free the list again */
  40. }
  41. }
  42. .fi
  43. .SH AVAILABILITY
  44. Added in curl 7.37.0
  45. .SH RETURN VALUE
  46. Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not.
  47. .SH SEE ALSO
  48. .BR CURLOPT_HEADEROPT (3),
  49. .BR CURLOPT_HTTPHEADER (3)