[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gnurl] 03/29: CURLOPT_HEADERFUNCTION.3: Document that size is always 1
From: |
gnunet |
Subject: |
[gnurl] 03/29: CURLOPT_HEADERFUNCTION.3: Document that size is always 1 |
Date: |
Fri, 10 Jan 2020 23:05:41 +0100 |
This is an automated email from the git hooks/post-receive script.
ng0 pushed a commit to branch master
in repository gnurl.
commit 97934a2f7129d286bf57c90cd2394a5c48dd1fa8
Author: Jay Satiro <address@hidden>
AuthorDate: Thu Dec 26 02:26:08 2019 -0500
CURLOPT_HEADERFUNCTION.3: Document that size is always 1
For compatibility with `fwrite`, the `CURLOPT_HEADERFUNCTION` callback
is passed two `size_t` parameters which, when multiplied, designate the
number of bytes of data passed in. In practice, CURL always sets the
first parameter (`size`) to 1.
This practice is also enshrined in documentation and cannot be changed
in future. The documentation states that the default callback is
`fwrite`, which means `fwrite` must be a suitable function for this
purpose. However, the documentation also states that the callback must
return the number of *bytes* it successfully handled, whereas ISO C
`fwrite` returns the number of items (each of size `size`) which it
wrote. The only way these numbers can be equal is if `size` is 1.
Since `size` is 1 and can never be changed in future anyway, document
that fact explicitly and let users rely on it.
Reported-by: Frank Gevaerts
Commit-message-by: Christopher Head
Ref: https://github.com/curl/curl/pull/2787
Fixes https://github.com/curl/curl/issues/4758
---
docs/libcurl/opts/CURLOPT_HEADERFUNCTION.3 | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/docs/libcurl/opts/CURLOPT_HEADERFUNCTION.3
b/docs/libcurl/opts/CURLOPT_HEADERFUNCTION.3
index 732fa1719..1cab96ebd 100644
--- a/docs/libcurl/opts/CURLOPT_HEADERFUNCTION.3
+++ b/docs/libcurl/opts/CURLOPT_HEADERFUNCTION.3
@@ -39,9 +39,9 @@ shown above.
This function gets called by libcurl as soon as it has received header
data. The header callback will be called once for each header and only
complete header lines are passed on to the callback. Parsing headers is very
-easy using this. The size of the data pointed to by \fIbuffer\fP is \fIsize\fP
-multiplied with \fInitems\fP. Do not assume that the header line is zero
-terminated!
+easy using this. \fIbuffer\fP points to the delivered data, and the size of
+that data is \fInitems\fP; \fIsize\fP is always 1. Do not assume that the
+header line is zero terminated!
The pointer named \fIuserdata\fP is the one you set with the
\fICURLOPT_HEADERDATA(3)\fP option.
--
To stop receiving notification emails like this one, please contact
address@hidden.
- [gnurl] branch master updated (71b588320 -> 697584161), gnunet, 2020/01/10
- [gnurl] 01/29: url2file.c: fix copyright year, gnunet, 2020/01/10
- [gnurl] 04/29: os400: Add missing CURLE error constants, gnunet, 2020/01/10
- [gnurl] 03/29: CURLOPT_HEADERFUNCTION.3: Document that size is always 1,
gnunet <=
- [gnurl] 02/29: examples/postinmemory.c: Call curl_global_cleanup always, gnunet, 2020/01/10
- [gnurl] 07/29: tool_operate: fix mem leak when failed config parse, gnunet, 2020/01/10
- [gnurl] 05/29: lib: fix warnings found when porting to NuttX, gnunet, 2020/01/10
- [gnurl] 06/29: lib: remove erroneous +x file permission on some c files, gnunet, 2020/01/10
- [gnurl] 09/29: bearssl: Improve I/O handling, gnunet, 2020/01/10
- [gnurl] 10/29: tests: Change NTLM tests to require SSL, gnunet, 2020/01/10
- [gnurl] 08/29: travis: Fix error detection, gnunet, 2020/01/10
- [gnurl] 11/29: tool: make a few char pointers point to const char instead, gnunet, 2020/01/10
- [gnurl] 23/29: file: fix copyright year range, gnunet, 2020/01/10
- [gnurl] 12/29: tests: Fix bounce requests with truncated writes, gnunet, 2020/01/10