mirror of
https://github.com/curl/curl.git
synced 2026-07-29 04:23:08 +03:00
ngtcp2: share common functionality
Share common functions/structs between ngtcp2 HTTP/3 and the proxy version. Fix bugs in proxy implementation when it comes to stream and pollset handling and transfer lifetimes. Curl_multi_xfer_sockbuf_borrow: work without multi When a connection gets shutdown by a share, the easy handle used is share->admin and it does not have a multi handle. In that case let Curl_multi_xfer_sockbuf_borrow() allocate a buffer to be freed on release. This happens when a TLS filter sends its last notify through a HTTP/3 proxy tunnel. Closes #21871
This commit is contained in:
parent
4fcf9c8f59
commit
f924489b25
43 changed files with 3254 additions and 4970 deletions
20
lib/multi.c
20
lib/multi.c
|
|
@ -4074,11 +4074,12 @@ CURLcode Curl_multi_xfer_sockbuf_borrow(struct Curl_easy *data,
|
|||
size_t blen, char **pbuf)
|
||||
{
|
||||
DEBUGASSERT(data);
|
||||
DEBUGASSERT(data->multi);
|
||||
*pbuf = NULL;
|
||||
if(!data->multi) {
|
||||
failf(data, "transfer has no multi handle");
|
||||
return CURLE_FAILED_INIT;
|
||||
/* When a SHARE gets destroyed and has a connection pool, we get
|
||||
* call with share->admin which does not have a multi handle. */
|
||||
*pbuf = curlx_malloc(blen);
|
||||
return *pbuf ? CURLE_OK : CURLE_OUT_OF_MEMORY;
|
||||
}
|
||||
if(data->multi->xfer_sockbuf_borrowed) {
|
||||
failf(data, "attempt to borrow xfer_sockbuf when already borrowed");
|
||||
|
|
@ -4107,11 +4108,16 @@ CURLcode Curl_multi_xfer_sockbuf_borrow(struct Curl_easy *data,
|
|||
|
||||
void Curl_multi_xfer_sockbuf_release(struct Curl_easy *data, char *buf)
|
||||
{
|
||||
(void)buf;
|
||||
DEBUGASSERT(data);
|
||||
DEBUGASSERT(data->multi);
|
||||
DEBUGASSERT(!buf || data->multi->xfer_sockbuf == buf);
|
||||
data->multi->xfer_sockbuf_borrowed = FALSE;
|
||||
if(!data->multi) {
|
||||
/* When a SHARE gets destroyed and has a connection pool, we get
|
||||
* call with share->admin which does not have a multi handle. */
|
||||
curlx_free(buf);
|
||||
}
|
||||
else {
|
||||
DEBUGASSERT(!buf || data->multi->xfer_sockbuf == buf);
|
||||
data->multi->xfer_sockbuf_borrowed = FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
static void multi_xfer_bufs_free(struct Curl_multi *multi)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue