CURLOPT_ALTSVC_CTRL.3 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. .\" generated by cd2nroff 0.1 from CURLOPT_ALTSVC_CTRL.md
  2. .TH CURLOPT_ALTSVC_CTRL 3 "2025-01-17" libcurl
  3. .SH NAME
  4. CURLOPT_ALTSVC_CTRL \- control alt\-svc behavior
  5. .SH SYNOPSIS
  6. .nf
  7. #include <curl/curl.h>
  8. #define CURLALTSVC_READONLYFILE (1<<2)
  9. #define CURLALTSVC_H1 (1<<3)
  10. #define CURLALTSVC_H2 (1<<4)
  11. #define CURLALTSVC_H3 (1<<5)
  12. CURLcode curl_easy_setopt(CURL *handle, CURLOPT_ALTSVC_CTRL, long bitmask);
  13. .fi
  14. .SH DESCRIPTION
  15. Populate the long \fIbitmask\fP with the correct set of features to instruct
  16. libcurl how to handle Alt\-Svc for the transfers using this handle.
  17. libcurl only accepts Alt\-Svc headers over a secure transport, meaning
  18. HTTPS. It also only completes a request to an alternative origin if that
  19. origin is properly hosted over HTTPS. These requirements are there to make
  20. sure both the source and the destination are legitimate.
  21. Alternative services are only used when setting up new connections. If there
  22. exists an existing connection to the host in the connection pool, then that is
  23. preferred.
  24. If \fICURLOPT_ALTSVC(3)\fP is set, \fICURLOPT_ALTSVC_CTRL(3)\fP gets a default value
  25. corresponding to CURLALTSVC_H1 | CURLALTSVC_H2 | CURLALTSVC_H3 \- the HTTP/2
  26. and HTTP/3 bits are only set if libcurl was built with support for those
  27. versions.
  28. Setting any bit enables the alt\-svc engine.
  29. .IP CURLALTSVC_READONLYFILE
  30. Do not write the alt\-svc cache back to the file specified with
  31. \fICURLOPT_ALTSVC(3)\fP even if it gets updated. By default a file specified
  32. with that option is read and written to as deemed necessary.
  33. .IP CURLALTSVC_H1
  34. Accept alternative services offered over HTTP/1.1.
  35. .IP CURLALTSVC_H2
  36. Accept alternative services offered over HTTP/2. This is only used if libcurl
  37. was also built to actually support HTTP/2, otherwise this bit is ignored.
  38. .IP CURLALTSVC_H3
  39. Accept alternative services offered over HTTP/3. This is only used if libcurl
  40. was also built to actually support HTTP/3, otherwise this bit is ignored.
  41. .SH DEFAULT
  42. 0 \- Alt\-Svc handling is disabled
  43. .SH PROTOCOLS
  44. This functionality affects http only
  45. .SH EXAMPLE
  46. .nf
  47. int main(void)
  48. {
  49. CURL *curl = curl_easy_init();
  50. if(curl) {
  51. curl_easy_setopt(curl, CURLOPT_ALTSVC_CTRL, (long)CURLALTSVC_H1);
  52. curl_easy_setopt(curl, CURLOPT_ALTSVC, "altsvc-cache.txt");
  53. curl_easy_perform(curl);
  54. }
  55. }
  56. .fi
  57. .SH AVAILABILITY
  58. Added in curl 7.64.1
  59. .SH RETURN VALUE
  60. Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not.
  61. .SH SEE ALSO
  62. .BR CURLOPT_ALTSVC (3),
  63. .BR CURLOPT_CONNECT_TO (3),
  64. .BR CURLOPT_RESOLVE (3)