lib: add CURLINFO_CONN_ID and CURLINFO_XFER_ID

- 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 #11185
This commit is contained in:
Stefan Eissing 2023-05-23 12:48:58 +02:00 committed by Daniel Stenberg
parent fdda99c6ee
commit e024d5665d
No known key found for this signature in database
GPG key ID: 5CC908FDB71E12C2
31 changed files with 252 additions and 94 deletions

View file

@ -75,6 +75,7 @@ static const struct httpmap http_version[] = {
static const struct writeoutvar variables[] = {
{"certs", VAR_CERT, CURLINFO_NONE, writeString},
{"content_type", VAR_CONTENT_TYPE, CURLINFO_CONTENT_TYPE, writeString},
{"conn_id", VAR_CONN_ID, CURLINFO_CONN_ID, writeOffset},
{"errormsg", VAR_ERRORMSG, CURLINFO_NONE, writeString},
{"exitcode", VAR_EXITCODE, CURLINFO_NONE, writeLong},
{"filename_effective", VAR_EFFECTIVE_FILENAME, CURLINFO_NONE, writeString},
@ -145,6 +146,7 @@ static const struct writeoutvar variables[] = {
{"urle.zoneid", VAR_INPUT_URLEZONEID, CURLINFO_NONE, writeString},
{"url_effective", VAR_EFFECTIVE_URL, CURLINFO_EFFECTIVE_URL, writeString},
{"urlnum", VAR_URLNUM, CURLINFO_NONE, writeLong},
{"xfer_id", VAR_EASY_ID, CURLINFO_XFER_ID, writeOffset},
{NULL, VAR_NONE, CURLINFO_NONE, NULL}
};

View file

@ -32,6 +32,8 @@ typedef enum {
VAR_CERT,
VAR_CONNECT_TIME,
VAR_CONTENT_TYPE,
VAR_CONN_ID,
VAR_EASY_ID,
VAR_EFFECTIVE_FILENAME,
VAR_EFFECTIVE_METHOD,
VAR_EFFECTIVE_URL,