urldata: introduce data->mid, a unique identifier inside a multi

`data->id` is unique in *most* situations, but not in all. If a libcurl
application uses more than one connection cache, they will overlap. This
is a rare situations, but libcurl apps do crazy things. However, for
informative things, like tracing, `data->id` is superior, since it
assigns new ids in curl's serial curl_easy_perform() use.

Introduce `data->mid` which is a unique identifer inside one multi
instance, assigned on multi_add_handle() and cleared on
multi_remove_handle().

Use the `mid` in DoH operations and also in h2/h3 stream hashes.

Reported-by: 罗朝辉
Fixes #14414
Closes #14499
This commit is contained in:
Stefan Eissing 2024-08-12 11:28:19 +02:00 committed by Daniel Stenberg
parent ad6320b8a5
commit 22d292b3ec
No known key found for this signature in database
GPG key ID: 5CC908FDB71E12C2
13 changed files with 133 additions and 51 deletions

View file

@ -153,4 +153,10 @@ CURLcode Curl_multi_xfer_ulbuf_borrow(struct Curl_easy *data,
*/
void Curl_multi_xfer_ulbuf_release(struct Curl_easy *data, char *buf);
/**
* Get the transfer handle for the given id. Returns NULL if not found.
*/
struct Curl_easy *Curl_multi_get_handle(struct Curl_multi *multi,
curl_off_t id);
#endif /* HEADER_CURL_MULTIIF_H */