diff options
-rw-r--r-- | lib/asyn-ares.c | 5 | ||||
-rw-r--r-- | lib/asyn-base.c | 6 | ||||
-rw-r--r-- | lib/bufq.c | 3 | ||||
-rw-r--r-- | lib/easy.c | 57 | ||||
-rw-r--r-- | lib/vquic/vquic.c | 35 | ||||
-rw-r--r-- | tests/data/test1330 | 3 | ||||
-rw-r--r-- | tests/data/test1506 | 2 | ||||
-rw-r--r-- | tests/data/test1508 | 3 | ||||
-rw-r--r-- | tests/data/test1510 | 2 | ||||
-rw-r--r-- | tests/data/test1512 | 2 | ||||
-rw-r--r-- | tests/data/test1521 | 3 | ||||
-rw-r--r-- | tests/data/test1537 | 3 | ||||
-rw-r--r-- | tests/data/test1538 | 3 | ||||
-rw-r--r-- | tests/data/test1550 | 3 | ||||
-rw-r--r-- | tests/data/test1557 | 2 | ||||
-rw-r--r-- | tests/data/test1564 | 2 | ||||
-rw-r--r-- | tests/data/test1597 | 3 | ||||
-rw-r--r-- | tests/data/test2402 | 2 | ||||
-rw-r--r-- | tests/data/test2404 | 2 | ||||
-rw-r--r-- | tests/data/test2502 | 2 | ||||
-rw-r--r-- | tests/data/test3026 | 3 | ||||
-rw-r--r-- | tests/data/test501 | 3 | ||||
-rw-r--r-- | tests/data/test509 | 3 | ||||
-rw-r--r-- | tests/data/test517 | 3 | ||||
-rw-r--r-- | tests/data/test543 | 4 | ||||
-rw-r--r-- | tests/data/test557 | 3 | ||||
-rw-r--r-- | tests/data/test558 | 3 | ||||
-rw-r--r-- | tests/data/test751 | 3 |
28 files changed, 72 insertions, 96 deletions
diff --git a/lib/asyn-ares.c b/lib/asyn-ares.c index bb3f4af0b..3eb769d93 100644 --- a/lib/asyn-ares.c +++ b/lib/asyn-ares.c @@ -280,8 +280,9 @@ void Curl_async_ares_destroy(struct Curl_easy *data) CURLcode Curl_async_pollset(struct Curl_easy *data, struct easy_pollset *ps) { struct async_ares_ctx *ares = &data->state.async.ares; - DEBUGASSERT(ares->channel); - return Curl_ares_pollset(data, ares->channel, ps); + if(ares->channel) + return Curl_ares_pollset(data, ares->channel, ps); + return CURLE_OK; } /* diff --git a/lib/asyn-base.c b/lib/asyn-base.c index c0df7aac5..eb2240b81 100644 --- a/lib/asyn-base.c +++ b/lib/asyn-base.c @@ -91,6 +91,10 @@ CURLcode Curl_ares_pollset(struct Curl_easy *data, timediff_t milli; CURLcode result = CURLE_OK; + DEBUGASSERT(channel); + if(!channel) + return CURLE_FAILED_INIT; + bitmap = ares_getsock(channel, (ares_socket_t *)sockets, CURL_ARRAYSIZE(sockets)); for(i = 0; i < CURL_ARRAYSIZE(sockets); ++i) { @@ -107,6 +111,8 @@ CURLcode Curl_ares_pollset(struct Curl_easy *data, } timeout = ares_timeout(channel, &maxtime, &timebuf); + if(!timeout) + timeout = &maxtime; milli = curlx_tvtoms(timeout); Curl_expire(data, milli, EXPIRE_ASYNC_NAME); return result; diff --git a/lib/bufq.c b/lib/bufq.c index c97640a63..40d1af0c1 100644 --- a/lib/bufq.c +++ b/lib/bufq.c @@ -602,8 +602,7 @@ static CURLcode bufq_slurpn(struct bufq *q, size_t max_len, break; } else if(n == 0) { - /* eof */ - result = CURLE_OK; + /* eof, result remains CURLE_OK */ break; } *pnread += n; diff --git a/lib/easy.c b/lib/easy.c index b526e6cff..b9b8d5275 100644 --- a/lib/easy.c +++ b/lib/easy.c @@ -567,6 +567,39 @@ static unsigned int populate_fds(struct pollfd *fds, struct events *ev) return numfds; } +/* poll_fds() + * + * poll the fds[] array + */ +static CURLcode poll_fds(struct events *ev, + struct pollfd *fds, + const unsigned int numfds, + int *pollrc) +{ + if(numfds) { + /* wait for activity or timeout */ +#if DEBUG_EV_POLL + fprintf(stderr, "poll(numfds=%u, timeout=%ldms)\n", numfds, ev->ms); +#endif + *pollrc = Curl_poll(fds, numfds, ev->ms); +#if DEBUG_EV_POLL + fprintf(stderr, "poll(numfds=%u, timeout=%ldms) -> %d\n", + numfds, ev->ms, *pollrc); +#endif + if(*pollrc < 0) + return CURLE_UNRECOVERABLE_POLL; + } + else { +#if DEBUG_EV_POLL + fprintf(stderr, "poll, but no fds, wait timeout=%ldms\n", ev->ms); +#endif + *pollrc = 0; + if(ev->ms > 0) + curlx_wait_ms(ev->ms); + } + return CURLE_OK; +} + /* wait_or_timeout() * * waits for activity on any of the given sockets, or the timeout to trigger. @@ -587,27 +620,9 @@ static CURLcode wait_or_timeout(struct Curl_multi *multi, struct events *ev) /* get the time stamp to use to figure out how long poll takes */ before = curlx_now(); - if(numfds) { - /* wait for activity or timeout */ -#if DEBUG_EV_POLL - fprintf(stderr, "poll(numfds=%u, timeout=%ldms)\n", numfds, ev->ms); -#endif - pollrc = Curl_poll(fds, numfds, ev->ms); -#if DEBUG_EV_POLL - fprintf(stderr, "poll(numfds=%u, timeout=%ldms) -> %d\n", - numfds, ev->ms, pollrc); -#endif - if(pollrc < 0) - return CURLE_UNRECOVERABLE_POLL; - } - else { -#if DEBUG_EV_POLL - fprintf(stderr, "poll, but no fds, wait timeout=%ldms\n", ev->ms); -#endif - pollrc = 0; - if(ev->ms > 0) - curlx_wait_ms(ev->ms); - } + result = poll_fds(ev, fds, numfds, &pollrc); + if(result) + return result; ev->msbump = FALSE; /* reset here */ diff --git a/lib/vquic/vquic.c b/lib/vquic/vquic.c index 43a2c9502..f3a02f63a 100644 --- a/lib/vquic/vquic.c +++ b/lib/vquic/vquic.c @@ -30,6 +30,9 @@ #ifdef HAVE_FCNTL_H #include <fcntl.h> #endif +#ifdef USE_NGHTTP3 +#include <nghttp3/nghttp3.h> +#endif #include "../urldata.h" #include "../bufq.h" #include "../curlx/dynbuf.h" @@ -726,55 +729,55 @@ CURLcode Curl_conn_may_http3(struct Curl_easy *data, #if defined(USE_NGTCP2) || defined(USE_NGHTTP3) -static void *Curl_ngtcp2_malloc(size_t size, void *user_data) +static void *vquic_ngtcp2_malloc(size_t size, void *user_data) { (void)user_data; return Curl_cmalloc(size); } -static void Curl_ngtcp2_free(void *ptr, void *user_data) +static void vquic_ngtcp2_free(void *ptr, void *user_data) { (void)user_data; Curl_cfree(ptr); } -static void *Curl_ngtcp2_calloc(size_t nmemb, size_t size, void *user_data) +static void *vquic_ngtcp2_calloc(size_t nmemb, size_t size, void *user_data) { (void)user_data; return Curl_ccalloc(nmemb, size); } -static void *Curl_ngtcp2_realloc(void *ptr, size_t size, void *user_data) +static void *vquic_ngtcp2_realloc(void *ptr, size_t size, void *user_data) { (void)user_data; return Curl_crealloc(ptr, size); } #ifdef USE_NGTCP2 -static struct ngtcp2_mem curl_ngtcp2_mem = { +static struct ngtcp2_mem vquic_ngtcp2_mem = { NULL, - Curl_ngtcp2_malloc, - Curl_ngtcp2_free, - Curl_ngtcp2_calloc, - Curl_ngtcp2_realloc + vquic_ngtcp2_malloc, + vquic_ngtcp2_free, + vquic_ngtcp2_calloc, + vquic_ngtcp2_realloc }; struct ngtcp2_mem *Curl_ngtcp2_mem(void) { - return &curl_ngtcp2_mem; + return &vquic_ngtcp2_mem; } #endif #ifdef USE_NGHTTP3 -static struct nghttp3_mem curl_nghttp3_mem = { +static struct nghttp3_mem vquic_nghttp3_mem = { NULL, - Curl_ngtcp2_malloc, - Curl_ngtcp2_free, - Curl_ngtcp2_calloc, - Curl_ngtcp2_realloc + vquic_ngtcp2_malloc, + vquic_ngtcp2_free, + vquic_ngtcp2_calloc, + vquic_ngtcp2_realloc }; struct nghttp3_mem *Curl_nghttp3_mem(void) { - return &curl_nghttp3_mem; + return &vquic_nghttp3_mem; } #endif diff --git a/tests/data/test1330 b/tests/data/test1330 index 4e97162b5..93b860461 100644 --- a/tests/data/test1330 +++ b/tests/data/test1330 @@ -23,9 +23,6 @@ TrackMemory <name> unit tests memory tracking operational </name> -<command> -nothing -</command> </client> # diff --git a/tests/data/test1506 b/tests/data/test1506 index d3cec0578..ed95e3be6 100644 --- a/tests/data/test1506 +++ b/tests/data/test1506 @@ -55,7 +55,7 @@ lib%TESTNUMBER HTTP GET connection cache limit (CURLMOPT_MAXCONNECTS) </name> <command> -http://%HOSTIP:%HTTPPORT/path/%TESTNUMBER %HOSTIP %HTTPPORT +- %HOSTIP %HTTPPORT </command> </client> diff --git a/tests/data/test1508 b/tests/data/test1508 index 9b210ec0f..65345df7b 100644 --- a/tests/data/test1508 +++ b/tests/data/test1508 @@ -17,9 +17,6 @@ lib%TESTNUMBER <name> Close a multi handle without using it </name> -<command> -http://%HOSTIP:%NOLISTENPORT/path/%TESTNUMBER -</command> </client> # Verify data after the test has been "shot" diff --git a/tests/data/test1510 b/tests/data/test1510 index 236fbde3d..4a80b7a1d 100644 --- a/tests/data/test1510 +++ b/tests/data/test1510 @@ -55,7 +55,7 @@ lib%TESTNUMBER HTTP GET connection cache limit (CURLOPT_MAXCONNECTS) </name> <command> -http://%HOSTIP:%HTTPPORT/path/%TESTNUMBER %HOSTIP %HTTPPORT +- %HOSTIP %HTTPPORT </command> </client> diff --git a/tests/data/test1512 b/tests/data/test1512 index c0c23467b..a0e321432 100644 --- a/tests/data/test1512 +++ b/tests/data/test1512 @@ -54,7 +54,7 @@ lib%TESTNUMBER GLOBAL CACHE test over two easy performs </name> <command> -http://%HOSTIP:%HTTPPORT/path/%TESTNUMBER %HOSTIP %HTTPPORT +- %HOSTIP %HTTPPORT </command> </client> diff --git a/tests/data/test1521 b/tests/data/test1521 index f62f58c5f..a6319e3f3 100644 --- a/tests/data/test1521 +++ b/tests/data/test1521 @@ -18,9 +18,6 @@ lib%TESTNUMBER <name> Test all curl_easy_setopt and curl_easy_getinfo options </name> -<command> -unused -</command> </client> # diff --git a/tests/data/test1537 b/tests/data/test1537 index c999e9a6b..9e585b7a2 100644 --- a/tests/data/test1537 +++ b/tests/data/test1537 @@ -22,9 +22,6 @@ lib%TESTNUMBER <name> libcurl URL escape/unescape tests </name> -<command> -nothing -</command> </client> # diff --git a/tests/data/test1538 b/tests/data/test1538 index 0615a9a4c..02f8bc431 100644 --- a/tests/data/test1538 +++ b/tests/data/test1538 @@ -23,9 +23,6 @@ lib%TESTNUMBER <name> libcurl strerror API call tests </name> -<command> -nothing -</command> </client> # diff --git a/tests/data/test1550 b/tests/data/test1550 index 3d747792f..8fd36f72e 100644 --- a/tests/data/test1550 +++ b/tests/data/test1550 @@ -22,8 +22,5 @@ lib%TESTNUMBER <name> verify setting pipelining blocklisting options </name> -<command> -http://%HOSTIP:%NOLISTENPORT/%TESTNUMBER -</command> </client> </testcase> diff --git a/tests/data/test1557 b/tests/data/test1557 index ae4ac42a2..738a58dab 100644 --- a/tests/data/test1557 +++ b/tests/data/test1557 @@ -21,7 +21,7 @@ lib%TESTNUMBER Remove easy handle in pending connections doesn't leave dangling entry </name> <command> -nothing +hostname.invalid </command> </client> diff --git a/tests/data/test1564 b/tests/data/test1564 index 59cef7157..e69067450 100644 --- a/tests/data/test1564 +++ b/tests/data/test1564 @@ -24,8 +24,6 @@ lib%TESTNUMBER <name> wakeup before poll with no easy handles </name> -<command> -</command> </client> # Verify data after the test has been "shot" diff --git a/tests/data/test1597 b/tests/data/test1597 index 047bf7bd8..0becf616c 100644 --- a/tests/data/test1597 +++ b/tests/data/test1597 @@ -19,9 +19,6 @@ CURLOPT_PROTOCOLS_STR <tool> lib%TESTNUMBER </tool> -<command> -- -</command> </client> <verify> diff --git a/tests/data/test2402 b/tests/data/test2402 index 563443171..4e08e45ac 100644 --- a/tests/data/test2402 +++ b/tests/data/test2402 @@ -60,7 +60,7 @@ lib%TESTNUMBER HTTP GET multiple files over HTTP/2 using HTTPS </name> <command> -https://%HOSTIP:%HTTP2TLSPORT/path/%TESTNUMBER %HOSTIP %HTTP2TLSPORT +- %HOSTIP %HTTP2TLSPORT </command> </client> diff --git a/tests/data/test2404 b/tests/data/test2404 index 4ebcceac8..13e48c8be 100644 --- a/tests/data/test2404 +++ b/tests/data/test2404 @@ -60,7 +60,7 @@ lib%TESTNUMBER HTTP/2 using STREAM_WEIGHTs </name> <command> -https://%HOSTIP:%HTTP2TLSPORT/path/%TESTNUMBER %HOSTIP %HTTP2TLSPORT +- %HOSTIP %HTTP2TLSPORT </command> </client> diff --git a/tests/data/test2502 b/tests/data/test2502 index 311b23def..f7822e8c2 100644 --- a/tests/data/test2502 +++ b/tests/data/test2502 @@ -59,7 +59,7 @@ lib%TESTNUMBER HTTP GET multiple over HTTP/3 </name> <command> -https://%HOSTIP:%HTTP3PORT/path/%TESTNUMBER %HOSTIP %HTTP3PORT %CERTDIR/certs/test-ca.cacert +- %HOSTIP %HTTP3PORT %CERTDIR/certs/test-ca.cacert </command> </client> diff --git a/tests/data/test3026 b/tests/data/test3026 index ee9b30678..08d74c4d9 100644 --- a/tests/data/test3026 +++ b/tests/data/test3026 @@ -30,9 +30,6 @@ curl_global_init thread-safety <tool> lib%TESTNUMBER </tool> -<command> -none -</command> </client> # diff --git a/tests/data/test501 b/tests/data/test501 index fb115cba6..3661351ea 100644 --- a/tests/data/test501 +++ b/tests/data/test501 @@ -25,9 +25,6 @@ lib%TESTNUMBER <name> simple libcurl attempt operation without URL set </name> -<command> -http://%HOSTIP:%NOLISTENPORT/%TESTNUMBER -</command> </client> # diff --git a/tests/data/test509 b/tests/data/test509 index 4cdbe80db..4990f3738 100644 --- a/tests/data/test509 +++ b/tests/data/test509 @@ -25,9 +25,6 @@ lib%TESTNUMBER <name> initialization with memory callbacks and actual usage </name> -<command> -nothing -</command> </client> # diff --git a/tests/data/test517 b/tests/data/test517 index ef18e3395..fb57f4a4b 100644 --- a/tests/data/test517 +++ b/tests/data/test517 @@ -23,9 +23,6 @@ lib%TESTNUMBER <name> curl_getdate() testing </name> -<command> -nothing -</command> </client> # diff --git a/tests/data/test543 b/tests/data/test543 index e3ac13bd2..2ec9ff863 100644 --- a/tests/data/test543 +++ b/tests/data/test543 @@ -17,10 +17,6 @@ lib%TESTNUMBER <name> curl_easy_escape </name> -<command> -- -</command> - </client> # Verify data after the test has been "shot" diff --git a/tests/data/test557 b/tests/data/test557 index 9d86c0ac2..08394d229 100644 --- a/tests/data/test557 +++ b/tests/data/test557 @@ -23,9 +23,6 @@ lib%TESTNUMBER <name> curl_mprintf() testing </name> -<command> -nothing -</command> </client> # diff --git a/tests/data/test558 b/tests/data/test558 index a7d6129e9..2dcf270bf 100644 --- a/tests/data/test558 +++ b/tests/data/test558 @@ -27,9 +27,6 @@ lib%TESTNUMBER <name> libtest memory tracking operational </name> -<command> -nothing -</command> </client> # diff --git a/tests/data/test751 b/tests/data/test751 index 21a3df250..49c6b67b1 100644 --- a/tests/data/test751 +++ b/tests/data/test751 @@ -22,9 +22,6 @@ lib%TESTNUMBER <name> multi - add many easy handles </name> -<command> -</command> -</file> </client> # 1000 easy handles needs memory |