curl / Mailing Lists / curl-library / Single Mail
Buy commercial curl support from WolfSSL. We help you work out your issues, debug your libcurl applications, use the API, port to new platforms, add new features and more. With a team lead by the curl founder himself.

Re: An API for extracing (HTTP) headers?

From: Daniel Stenberg via curl-library <curl-library_at_lists.haxx.se>
Date: Tue, 22 Mar 2022 19:03:02 +0100 (CET)

On Tue, 22 Mar 2022, Timothe Litt wrote:

>> There can be "the last header received" several times during a transfer and
>> I couldn't decide how to signal that proper!

> There's only one "last header received" for a given response.

The last CONNECT header, the last 1xx header, the last header, the last
pseudo header and the last trailer. For each response in the chain. That's a
lot of last headers.

> For the case of multiple responses (e.g. when you follow a redirect chain),
> a simple approach would be to also have a "last response" flag, which is set
> when headers are retrieved for the last request.

We can't always tell when it is the last response already when the first
headers arrive for a response so that would be a tricky one to "mark".

> I think the status code
> (which comes before any header) tells you whether you'll be making another
> request.  It certainly does for redirects.

For HTTP/1 yes, for later versions there's :status. But I don't think the
challenge is to know when there's a new response, we know when a new request
has been issued.

-- 
  / daniel.haxx.se
  | Commercial curl support up to 24x7 is available!
  | Private help, bug fixes, support, ports, new features
  | https://curl.se/support.html


-- 
Unsubscribe: https://lists.haxx.se/listinfo/curl-library
Etiquette:   https://curl.haxx.se/mail/etiquette.html
Received on 2022-03-22