Repository navigation
Conversation
There was a problem hiding this comment.
I'm thinking we should maybe switch to curl_off_t here to be sure this is a 64 bit type, as long will be 32 bit on Windows - and the inconsistency might cause confusions down the line.
Or if we are fine with "just" 32 bits before wrapping, maybe we can go with unsigned int.
Whichever direction, I think we can apply the same thinking to the *connection_id fields, for the same reasons.
There was a problem hiding this comment.
Both sound fine to me. With a 64 bit type, we reach uniqueness for all practical purposes, I guess (inside the same multi/conn cache).
The next question is then if we want to add this to all the info() statements or make this available to the logging functions. For the latter, it would sneak into the API and I am not sure that this is a good idea. But I do not know if someone is attached to the current log strings either.
There was a problem hiding this comment.
With a signed 32 bit counter, there is still a theoretical chance that someone could add a handle every millisecond for 25 days and see it reach max. Going 64 bit takes away the entire discussion.
For the latter, it would sneak into the API and I am not sure that this is a good idea.
Maybe, since the DEBUGFUNCTION gets a CURL * as an argument, we can add a CURLINFO_* variable for this "easy_id" so that the app can opt to show this?
It doesn't solve the connection id, and it also then does not make the output of these id use a standard look as it will be left for the application.
But I do not know if someone is attached to the current log strings either.
I think many users are used to them at the very least, but we never promised that they would remain like this.
There was a problem hiding this comment.
So, some more thinking between issue solving. A backwards compatible way to introduce this:
- go
curl_off_tfor transfer and connection id (do we have printf format for that one btw?) - add
CURLINFO_EASY_IDandCURLINFO_CONN_IDfor the app to retrieve identifiers (-1 for unassigned, e.g. easy not part of multi yet or connection not assigned) - add
--trace-idtocurlthat adds these to its verbose/trace output
Do we provide a standard implementation for apps to set as CURLOPT_DEBUGFUNCTION? Something along the lines of:
CURL_LOGFMT_DEFAULT (0)
CURL_LOGFMT_IDS (1 << 0) /* add EASY and CONN ids */
CURL_LOGFMT_TIME (1 << 1) /* add timestamps */
CURL_LOGFMT_HEXDUMP (1 << 2) /* dump data in hex table */
/* set DEBUGFUNCTION/DEBUGDATA to log to FILE for this easy handle */
curl_easy_set_log(CURL*, FILE*, int fmt)
/* set DEBUGFUNCTION/DEBUGDATA to log to FILE for all easy handles in multi
that have no other setting already */
curl_multi_set_log(CURLM*, FILE*, int fmt)
There was a problem hiding this comment.
I think you need to use "%" CURL_FORMAT_CURL_OFF_T everywhere for outputting curl_off_t variables correctly. The z flag is for size_t and it can be different than curl_off_t !
There was a problem hiding this comment.
I removed these macros.
There was a problem hiding this comment.
Shouldn't this be -1 now to match the documentation?
There was a problem hiding this comment.
Removed, no longer logged explicitly.
There was a problem hiding this comment.
Maybe use the transfer id instead for consistency?
There was a problem hiding this comment.
Removed the %p since --trace-ids takes care of that.
- add an `id` long to Curl_easy, -1 on init - once added to a multi (or its own multi), it gets a non-negative number assigned by the connection cache - `id` is unique among all transfers using the same cache until reaching LONG_MAX where it will wrap around. So, not unique eternally.
- curl_easy_getinfo() can be used to retrieve these - CURLINFO_CONN_ID returns the connection id attached to data or, if none present, data->state.lastconnect_id - variables and type declared in tool for write out
- it is not the identifier of the handle, but of the transfer done by it. - removing all changes to `infof()` statements
- added and documented --trace-ids to prepend (after the timestamp) the transfer and connection identifiers to each verbose log line - format is [n-m] with `n` being the transfer id and `m` being the connection id. In case there is not valid connection id, print 'x'. - Log calls with a handle that has no transfer id yet, are written without any ids.
…n the url in the log
- using CURL_FORMAT_OFF_T for connection ids - removed curl_log.h macros to log connection ids in infof() - changed CFLOG() implementation to only log the filter name since transfer and connection ids are now handled elsewhere - removed some connection id explicit logging where it is now redundant - removed some handle pointer logging
- added and documented --trace-ids to prepend (after the timestamp) the transfer and connection identifiers to each verbose log line - format is [n-m] with `n` being the transfer id and `m` being the connection id. In case there is not valid connection id, print 'x'. - Log calls with a handle that has no transfer id yet, are written without any ids. Closes #11185
- add an `id` long to Curl_easy, -1 on init - once added to a multi (or its own multi), it gets a non-negative number assigned by the connection cache - `id` is unique among all transfers using the same cache until reaching LONG_MAX where it will wrap around. So, not unique eternally. - CURLINFO_CONN_ID returns the connection id attached to data or, if none present, data->state.lastconnect_id - variables and type declared in tool for write out Closes curl#11185
- added and documented --trace-ids to prepend (after the timestamp) the transfer and connection identifiers to each verbose log line - format is [n-m] with `n` being the transfer id and `m` being the connection id. In case there is not valid connection id, print 'x'. - Log calls with a handle that has no transfer id yet, are written without any ids. Closes curl#11185
- add an `id` long to Curl_easy, -1 on init - once added to a multi (or its own multi), it gets a non-negative number assigned by the connection cache - `id` is unique among all transfers using the same cache until reaching LONG_MAX where it will wrap around. So, not unique eternally. - CURLINFO_CONN_ID returns the connection id attached to data or, if none present, data->state.lastconnect_id - variables and type declared in tool for write out Closes curl#11185
- added and documented --trace-ids to prepend (after the timestamp) the transfer and connection identifiers to each verbose log line - format is [n-m] with `n` being the transfer id and `m` being the connection id. In case there is not valid connection id, print 'x'. - Log calls with a handle that has no transfer id yet, are written without any ids. Closes curl#11185
Adding identifier to transfers and connections using the same connection cache (implicitly
the case when using the same multi handle). With type
curl_off_tthey are unique for all practical purposes.Adding new
CURLINFO_XFER_IDandCURLINFO_CONN_IDto the interface and documentationto make them accessible for libcurl applications.
Adding
--trace-idsto the curl command line to include the identifier in verbose log output. Example:This does not change any logging statements (yet). If we use these in the verbose output of
curlitself, it would be suitable to change several statements that now contain connection id and a handle pointer.