]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
CURLOPT_HEADER/WRITEFUNCTION.md: drop '* size' since size is always 1
authorDaniel Stenberg <daniel@haxx.se>
Sat, 20 Sep 2025 14:47:16 +0000 (16:47 +0200)
committerDaniel Stenberg <daniel@haxx.se>
Sat, 20 Sep 2025 15:27:17 +0000 (17:27 +0200)
Closes #18640

docs/libcurl/opts/CURLOPT_HEADERFUNCTION.md
docs/libcurl/opts/CURLOPT_WRITEFUNCTION.md

index 2f4c00a03ca5fad2a628f2836867c8a71002917a..8e16b78d5552f4b10e870bce048b34a84ed0cce0 100644 (file)
@@ -109,9 +109,9 @@ Nothing.
 static size_t header_callback(char *buffer, size_t size,
                               size_t nitems, void *userdata)
 {
-  /* received header is nitems * size long in 'buffer' NOT ZERO TERMINATED */
+  /* received header is 'nitems' bytes in 'buffer' NOT ZERO TERMINATED */
   /* 'userdata' is set with CURLOPT_HEADERDATA */
-  return nitems * size;
+  return nitems;
 }
 
 int main(void)
index 3ee11d8e476ef7478af8fed70e5af7490f429c63..973a0aea754e8f89f1fce621e633c3741619b813 100644 (file)
@@ -40,13 +40,12 @@ delivered data, and the size of that data is *nmemb*; *size* is always 1.
 The data passed to this function is not null-terminated.
 
 The callback function is passed as much data as possible in all invokes, but
-you must not make any assumptions. It may be one byte, it may be
-thousands. The maximum amount of body data that is passed to the write
-callback is defined in the curl.h header file: *CURL_MAX_WRITE_SIZE* (the
-usual default is 16K). If CURLOPT_HEADER(3) is enabled, which makes header
-data get passed to the write callback, you can get up to
-*CURL_MAX_HTTP_HEADER* bytes of header data passed into it. This usually means
-100K.
+you must not make any assumptions. It may be one byte, it may be thousands.
+The maximum amount of body data that is passed to the write callback is
+defined in the curl.h header file: *CURL_MAX_WRITE_SIZE* (the usual default is
+16K). If CURLOPT_HEADER(3) is enabled, which makes header data get passed to
+the write callback, you can get up to *CURL_MAX_HTTP_HEADER* bytes of header
+data passed into it. This usually means 100K.
 
 This function may be called with zero bytes data if the transferred file is
 empty.
@@ -90,7 +89,7 @@ struct memory {
 
 static size_t cb(char *data, size_t size, size_t nmemb, void *clientp)
 {
-  size_t realsize = size * nmemb;
+  size_t realsize = nmemb;
   struct memory *mem = (struct memory *)clientp;
 
   char *ptr = realloc(mem->response, mem->size + realsize + 1);