diff options
author | Stefan Eissing <stefan@eissing.org> | 2023-03-06 12:44:45 +0100 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2023-03-07 12:50:31 +0100 |
commit | 7c5637b8b4b8a5a125ba1556e50e4b092075a6a7 (patch) | |
tree | e671c307e08cc7eb2418a703a1870001d8c31855 /lib/cf-socket.c | |
parent | 6466071e8e85011057dfad4cc860029e391edeb8 (diff) | |
download | curl-7c5637b8b4b8a5a125ba1556e50e4b092075a6a7.tar.gz |
url: fix logic in connection reuse to deny reuse on "unclean" connections
- add parameter to `conn_is_alive()` cfilter method that returns
if there is input data waiting on the connection
- refrain from re-using connnection from the cache that have
input pending
- adapt http/2 and http/3 alive checks to digest pending input
to check the connection state
- remove check_cxn method from openssl as that was just doing
what the socket filter now does.
- add tests for connection reuse with special server configs
Closes #10690
Diffstat (limited to 'lib/cf-socket.c')
-rw-r--r-- | lib/cf-socket.c | 19 |
1 files changed, 4 insertions, 15 deletions
diff --git a/lib/cf-socket.c b/lib/cf-socket.c index 006c22d2c..86b024ac0 100644 --- a/lib/cf-socket.c +++ b/lib/cf-socket.c @@ -325,20 +325,6 @@ int Curl_socket_close(struct Curl_easy *data, struct connectdata *conn, return socket_close(data, conn, FALSE, sock); } -bool Curl_socket_is_dead(curl_socket_t sock) -{ - int sval; - bool ret_val = TRUE; - - sval = SOCKET_READABLE(sock, 0); - if(sval == 0) - /* timeout */ - ret_val = FALSE; - - return ret_val; -} - - #ifdef USE_WINSOCK /* When you run a program that uses the Windows Sockets API, you may experience slow performance when you copy data to a TCP server. @@ -1449,12 +1435,14 @@ static CURLcode cf_socket_cntrl(struct Curl_cfilter *cf, } static bool cf_socket_conn_is_alive(struct Curl_cfilter *cf, - struct Curl_easy *data) + struct Curl_easy *data, + bool *input_pending) { struct cf_socket_ctx *ctx = cf->ctx; struct pollfd pfd[1]; int r; + *input_pending = FALSE; (void)data; if(!ctx || ctx->sock == CURL_SOCKET_BAD) return FALSE; @@ -1479,6 +1467,7 @@ static bool cf_socket_conn_is_alive(struct Curl_cfilter *cf, } DEBUGF(LOG_CF(data, cf, "is_alive: valid events, looks alive")); + *input_pending = TRUE; return TRUE; } |