ITADN
curl/curl/Issues

Wrong HTTP headers size for HTTP >= 2

#21889OpenBazaarAcc32 创建于 2026-06-07
B
BazaarAcc32commented
### I did this To obtain the size of HTTP server response headers, libcurl provides the constant CURLINFO_HEADER_SIZE. However, this constant is only useful for HTTP/1.1 responses. This is because, regardless of the HTTP version, libcurl converts all headers to HTTP/1.1 style. This is convenient in itself, but CURLINFO_HEADER_SIZE for HTTP >= 2 returns the size of HTTP/1.1-style headers and does not provide the actual number of bytes sent by the server for headers. Therefore, CURLINFO_HEADER_SIZE is not particularly useful for HTTP >= 2 (because in this case, headers are transmitted via binary frames). ### I expected the following Therefore, I propose adding a new constant, such as CURLINFO_HEADER_REAL_SIZE, that would reflect the exact number of bytes for headers sent by the server. But for now, I have question: Is there currently a workaround in libcurl that will allow me to get the actual number of header bytes sent by the server for HTTP >= 2? ### curl/libcurl version curl 8.20.0 ### operating system Windows 11
0 条评论