I've been looking around and am quite surprised that there seems to be no means by which one can parse headers generically in libcurl (which seems to be the canonical C library for http these days).
The closest thing I've found was a mailing list post where someone suggested someone else search through the mailing list archives.
The only facility that is provided by libcurl via setopt is CURLOPT_HEADERFUNCTION
which will feed the header responses a single line at a time.
This seems entirely too primitive considering headers can span multiple lines. Ideally this should be done once correctly (preferably by the library itself) and not left for the application developers to do continually reinvent.
Edit:
An example of the naïve thing not working, see the following gist with a libcurl code example and a properly formed http response that it can't parse: https://gist.github.com/762954