CURLINFO_PROTOCOL.3 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. .\" generated by cd2nroff 0.1 from CURLINFO_PROTOCOL.md
  2. .TH CURLINFO_PROTOCOL 3 "2025-01-17" libcurl
  3. .SH NAME
  4. CURLINFO_PROTOCOL \- get the protocol used in the connection
  5. .SH SYNOPSIS
  6. .nf
  7. #include <curl/curl.h>
  8. CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_PROTOCOL, long *p);
  9. .fi
  10. .SH DESCRIPTION
  11. This option is deprecated. We strongly recommend using
  12. \fICURLINFO_SCHEME(3)\fP instead, because this option cannot return all
  13. possible protocols!
  14. Pass a pointer to a long to receive the version used in the last http
  15. connection. The returned value is set to one of the CURLPROTO_* values:
  16. .nf
  17. CURLPROTO_DICT, CURLPROTO_FILE, CURLPROTO_FTP, CURLPROTO_FTPS,
  18. CURLPROTO_GOPHER, CURLPROTO_HTTP, CURLPROTO_HTTPS, CURLPROTO_IMAP,
  19. CURLPROTO_IMAPS, CURLPROTO_LDAP, CURLPROTO_LDAPS, CURLPROTO_POP3,
  20. CURLPROTO_POP3S, CURLPROTO_RTMP, CURLPROTO_RTMPE, CURLPROTO_RTMPS,
  21. CURLPROTO_RTMPT, CURLPROTO_RTMPTE, CURLPROTO_RTMPTS, CURLPROTO_RTSP,
  22. CURLPROTO_SCP, CURLPROTO_SFTP, CURLPROTO_SMB, CURLPROTO_SMBS, CURLPROTO_SMTP,
  23. CURLPROTO_SMTPS, CURLPROTO_TELNET, CURLPROTO_TFTP, CURLPROTO_MQTT
  24. .fi
  25. .SH PROTOCOLS
  26. This functionality affects all supported protocols
  27. .SH EXAMPLE
  28. .nf
  29. int main(void)
  30. {
  31. CURL *curl = curl_easy_init();
  32. if(curl) {
  33. CURLcode res;
  34. curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
  35. res = curl_easy_perform(curl);
  36. if(res == CURLE_OK) {
  37. long protocol;
  38. curl_easy_getinfo(curl, CURLINFO_PROTOCOL, &protocol);
  39. }
  40. curl_easy_cleanup(curl);
  41. }
  42. }
  43. .fi
  44. .SH DEPRECATED
  45. Deprecated since 7.85.0.
  46. .SH AVAILABILITY
  47. Added in curl 7.52.0
  48. .SH RETURN VALUE
  49. Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not.
  50. .SH SEE ALSO
  51. .BR CURLINFO_RESPONSE_CODE (3),
  52. .BR curl_easy_getinfo (3),
  53. .BR curl_easy_setopt (3)