Repository navigation
Conversation
|
initinfo is called on perform not init. I don't think there would be any ramifications to calling it in init as well. as far as duphandle goes I'm pretty sure it's supposed to be like that. duphandle copies the options not the info. |
|
ah I just re-read what you wrote. you are saying since the info is not copied on duphandle it should initinfo. ok. |
|
Yeah. The inconsistency I was seeing was because 22cfeac started calling initinfo on reset, so a handle which was reset would have different values than a handle which was freshly initialized or freshly duplicated. I only noticed because we were calling reset on new handles automatically (changed in facebook/hhvm@7f4b85b) but the inconsistency seemed worth raising here. :-) |
- Call Curl_initinfo on init and duphandle. Prior to this change the statistical and informational variables were simply zeroed by calloc on easy init and duphandle. While zero is the correct default value for almost all info variables, there is one where it isn't (filetime initializes to -1). Bug: curl#1103 Reported-by: Neal Poole
|
@jay, thanks for your PR! By analyzing the history of the files in this pull request, we identified @bagder, @dfandrich and @captain-caveman2k to be potential reviewers. |
|
Ok I turned this into a PR with what I think we should do, someone please review. |
|
It'd be cool to add a test... |
- Call Curl_initinfo on init and duphandle. Prior to this change the statistical and informational variables were simply zeroed by calloc on easy init and duphandle. While zero is the correct default value for almost all info variables, there is one where it isn't (filetime initializes to -1). Bug: #1103 Reported-by: Neal Poole
Done, landed in 4564636. |
With the latest libcurl (v7.51.0) I ran into an odd behavior caused by Curl_initinfo not being called/copied over consistently. As a result, CURLINFO_FILETIME may oscillate between 0 and -1 unexpectedly.
curl_easy_init,Curl_initinfois not called. That meansCURLINFO_FILETIMEwill be set to 0.curl_easy_reseton that handle,Curl_initinfois called. This behavior is new starting in 22cfeac. That meansCURLINFO_FILETIMEwill be set to -1.curl_easy_duphandleon that handle,Curl_initinfois not called and the info is never set. That meansCURLINFO_FILETIMEwill be set to 0.This came up because of a test in HHVM (PHP interpreter) that tried to verify that two handles had the same info after calling
curl_easy_duphandle.curl_initin HHVM would callcurl_easy_initandcurl_easy_resetinternally, soCURLINFO_FILETIMEwould be set to -1. If you calledcurl_easy_duphandlethe new handle would haveCURLINFO_FILETIMEset to 0.It seems like for consistency the code could be doing a couple things to make the behavior consistent:
Curl_initinfoinsidecurl_easy_initCurl_initinfoincurl_easy_duphandle(if we don't care about not exactly duplicating the handle) or copying the data explicitly from one handle to the other.