-
-
Notifications
You must be signed in to change notification settings - Fork 6.7k
content length not available in header function, again #13752
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
it's http.c:3630 and following where the \r\n is written to the client before the analysis and the info things are set. |
Ok that works at least in initial tests. I also had to defer |
Just moving the Line 3663 in 1c4813c
I tried creating a dynbuf copy of the hd, hdlen data and then doing |
- HEADERFUNCTIONS might inspect response properties like CURLINFO_CONTENT_LENGTH_DOWNLOAD_T on seeing the last header line. If the line is being written before this is initialized, values are not available. - write the last header line late when analyzing a HTTP response so that all information is available at the time of the writing. - add test1485 to verify that CURLINFO_CONTENT_LENGTH_DOWNLOAD_T works on seeing the last header. - refs curl#13752
My proposal on how to solve this - test case included: #13757. |
I did this
Use
CURLINFO_CONTENT_LENGTH_DOWNLOAD_T
inCURLOPT_HEADERFUNCTION
function when the last header is processed (empty newline is received). Rather than getting the content length-1
is returned. The call working in this specific scenario is undocumented behaviour that some (broken) code relies on. This issue was tracked earlier as #7804 and has surfaced again couple of versions ago (not sure when exactly).I expected the following
Maybe this behaviour should be maintained since for example WebKit curl backend (*) is broken now. However, this is undocumented behaviour after all, so not fixing it is perfectly fine as well. WebKit and other code depending on this should be fixed either way.
*) https://github.com/WebKit/WebKit/blob/57affb62969db66ef07975567f4876d62d86da55/Source/WebCore/platform/network/curl/CurlRequest.cpp#L320
curl/libcurl version
curl 8.8.0
operating system
Linux hostname 6.8.9-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.8.9-1 (2024-05-15) x86_64 GNU/Linux
The text was updated successfully, but these errors were encountered: