Skip to content

Add header type information to the headers callback #20610

@mkauf

Description

@mkauf

I did this

The callback set by CURLOPT_HEADERFUNCTION is used by libcurl for multiple types of headers (e.g. 1xx headers, headers, trailers). The callback function does not know the type of headers that it gets. There are some hints in the documentation about how to do it. For some cases, it's very hard, e.g. an NTLM response with multiple header sets, empty body, and trailers.

Some releases ago, the function curl_easy_header() has been introduced, with flags for different header origins. So libcurl already knows the type of the headers. But currently there is no way to pass this information to the callback function.

I suggest to add a new libcurl option with a new callback definition, for example: CURLOPT_HEADERFUNCTION_EXTENDED with this callback: size_t header_callback_extended(char *buffer, size_t nitems, unsigned int origin, void *userdata);

What do you think?

I expected the following

The headers callback function gets information about the type of headers/trailers.

curl/libcurl version

master

operating system

Fedora Linux

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions