diff options
author | Jay Satiro <raysatiro@yahoo.com> | 2019-12-26 02:26:08 -0500 |
---|---|---|
committer | Jay Satiro <raysatiro@yahoo.com> | 2019-12-26 02:26:08 -0500 |
commit | 97934a2f7129d286bf57c90cd2394a5c48dd1fa8 (patch) | |
tree | ac11ba2bce7211ef1d1308804ba7ece831382fef /tests/server | |
parent | 68da0b8b8694328b214e687a6cff5cbb744dcfd5 (diff) |
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
Diffstat (limited to 'tests/server')
0 files changed, 0 insertions, 0 deletions