2
0

CURLMOPT_PUSHDATA.3 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. .\" **************************************************************************
  2. .\" * _ _ ____ _
  3. .\" * Project ___| | | | _ \| |
  4. .\" * / __| | | | |_) | |
  5. .\" * | (__| |_| | _ <| |___
  6. .\" * \___|\___/|_| \_\_____|
  7. .\" *
  8. .\" * Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
  9. .\" *
  10. .\" * This software is licensed as described in the file COPYING, which
  11. .\" * you should have received as part of this distribution. The terms
  12. .\" * are also available at https://curl.se/docs/copyright.html.
  13. .\" *
  14. .\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell
  15. .\" * copies of the Software, and permit persons to whom the Software is
  16. .\" * furnished to do so, under the terms of the COPYING file.
  17. .\" *
  18. .\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
  19. .\" * KIND, either express or implied.
  20. .\" *
  21. .\" * SPDX-License-Identifier: curl
  22. .\" *
  23. .\" **************************************************************************
  24. .\"
  25. .TH CURLMOPT_PUSHDATA 3 "1 Jun 2015" libcurl libcurl
  26. .SH NAME
  27. CURLMOPT_PUSHDATA \- pointer to pass to push callback
  28. .SH SYNOPSIS
  29. .nf
  30. #include <curl/curl.h>
  31. CURLMcode curl_multi_setopt(CURLM *handle, CURLMOPT_PUSHDATA, void *pointer);
  32. .fi
  33. .SH DESCRIPTION
  34. Set \fIpointer\fP to pass as the last argument to the
  35. \fICURLMOPT_PUSHFUNCTION(3)\fP callback. The pointer will not be touched or
  36. used by libcurl itself, only passed on to the callback function.
  37. .SH DEFAULT
  38. NULL
  39. .SH PROTOCOLS
  40. HTTP(S)
  41. .SH EXAMPLE
  42. .nf
  43. /* only allow pushes for file names starting with "push-" */
  44. int push_callback(CURL *parent,
  45. CURL *easy,
  46. size_t num_headers,
  47. struct curl_pushheaders *headers,
  48. void *clientp)
  49. {
  50. char *headp;
  51. int *transfers = (int *)clientp;
  52. FILE *out;
  53. headp = curl_pushheader_byname(headers, ":path");
  54. if(headp && !strncmp(headp, "/push-", 6)) {
  55. fprintf(stderr, "The PATH is %s\\n", headp);
  56. /* save the push here */
  57. out = fopen("pushed-stream", "wb");
  58. /* write to this file */
  59. curl_easy_setopt(easy, CURLOPT_WRITEDATA, out);
  60. (*transfers)++; /* one more */
  61. return CURL_PUSH_OK;
  62. }
  63. return CURL_PUSH_DENY;
  64. }
  65. curl_multi_setopt(multi, CURLMOPT_PUSHFUNCTION, push_callback);
  66. curl_multi_setopt(multi, CURLMOPT_PUSHDATA, &counter);
  67. .fi
  68. .SH AVAILABILITY
  69. Added in 7.44.0
  70. .SH RETURN VALUE
  71. Returns CURLM_OK if the option is supported, and CURLM_UNKNOWN_OPTION if not.
  72. .SH "SEE ALSO"
  73. .BR CURLMOPT_PUSHFUNCTION "(3), " CURLMOPT_PIPELINING "(3), "
  74. .BR CURLOPT_PIPEWAIT "(3), "
  75. .BR RFC 7540