CURLOPT_UPLOAD_BUFFERSIZE.3 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  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 CURLOPT_UPLOAD_BUFFERSIZE 3 "18 Aug 2018" libcurl libcurl
  26. .SH NAME
  27. CURLOPT_UPLOAD_BUFFERSIZE \- upload buffer size
  28. .SH SYNOPSIS
  29. .nf
  30. #include <curl/curl.h>
  31. CURLcode curl_easy_setopt(CURL *handle, CURLOPT_UPLOAD_BUFFERSIZE, long size);
  32. .fi
  33. .SH DESCRIPTION
  34. Pass a long specifying your preferred \fIsize\fP (in bytes) for the upload
  35. buffer in libcurl. It makes libcurl uses a larger buffer that gets passed to
  36. the next layer in the stack to get sent off. In some setups and for some
  37. protocols, there's a huge performance benefit of having a larger upload
  38. buffer.
  39. This is just treated as a request, not an order. You cannot be guaranteed to
  40. actually get the given size.
  41. The upload buffer size is by default 64 kilobytes. The maximum buffer size
  42. allowed to be set is 2 megabytes. The minimum buffer size allowed to be set is
  43. 16 kilobytes.
  44. Since curl 7.61.1 the upload buffer is allocated on-demand - so if the handle
  45. is not used for upload, this buffer will not be allocated at all.
  46. DO NOT set this option on a handle that is currently used for an active
  47. transfer as that may lead to unintended consequences.
  48. .SH DEFAULT
  49. 65536 bytes
  50. .SH PROTOCOLS
  51. All
  52. .SH EXAMPLE
  53. .nf
  54. CURL *curl = curl_easy_init();
  55. if(curl) {
  56. curl_easy_setopt(curl, CURLOPT_URL, "sftp://example.com/foo.bin");
  57. /* ask libcurl to allocate a larger upload buffer */
  58. curl_easy_setopt(curl, CURLOPT_UPLOAD_BUFFERSIZE, 120000L);
  59. ret = curl_easy_perform(curl);
  60. curl_easy_cleanup(curl);
  61. }
  62. .fi
  63. .SH AVAILABILITY
  64. Added in 7.62.0.
  65. .SH RETURN VALUE
  66. Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not.
  67. .SH "SEE ALSO"
  68. .BR CURLOPT_BUFFERSIZE "(3), " CURLOPT_READFUNCTION "(3), "