CURLOPT_UPLOAD_BUFFERSIZE.3 2.7 KB

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