Repository navigation
option CURLOPT_TCP_KEEPALIVE doesn't work with new version #14368
Description
Activity
I used wireShark to analyze the net package .The new version really doesn't send the [Tcp keep-alive ack] package.
So,I use curl with wrong way?Or is something wrong with the new version.
That's all.Tell us how you build your libcurl. Or maybe single-step through tcpkeepalive and tell us where it goes wrong?
Line 171 in acbc6b7
tcpkeepalive(struct Curl_easy *data, cmake-gui output info:
/////////////////////////////////////////
Using CMake version 3.22.2
Selecting Windows SDK version 10.0.19041.0 to target Windows 10.0.19045.
curl version=[8.9.1]
Could NOT find LibPSL (missing: LIBPSL_LIBRARY LIBPSL_INCLUDE_DIR)
Could NOT find LibSSH2 (missing: LIBSSH2_LIBRARY LIBSSH2_INCLUDE_DIR)
Performing Test HAVE_WIN32_WINNT
Performing Test HAVE_WIN32_WINNT - Success
Found _WIN32_WINNT=0x0a00
Protocols: dict file ftp ftps gopher gophers http https imap imaps ipfs ipns ldap ldaps mqtt pop3 pop3s rtsp smb smbs smtp smtps telnet tftp
Features: alt-svc AsynchDNS HSTS HTTPS-proxy IPv6 Largefile libz NTLM SSL threadsafe TLS-SRP UnixSockets
Enabled SSL backends: OpenSSL
Configuring doneI built curl on windows 10 with the default cmake options, and the problem is in lib\cf-socket.c KEEPALIVE_FACTOR is set to 1000 so they are being converted to milliseconds, but it is using setsockopt which is expecting seconds. PR here, sorry if any mistakes, first time: #14606
- added a commit that references this issue
on Aug 20, 2024

I did this
I use curl to request to a php web api.
The PHP server will take a long time to answer the request ,like 600 seconds.So,I need to keep alive to wait the reply.
Old version 7.65.3 works well,but new version failed .I tried new two version 8.9.0,8.9.1,complied in win 10 with vs2019.
main code like this:
`//http is the same,this url sleep ,eg,300s ,then reply
curl_easy_setopt(curl, CURLOPT_URL, "https://www.some.com");
curl_easy_setopt(curl, CURLOPT_TCP_KEEPALIVE, 1L);
//
curl_easy_setopt(curl, CURLOPT_TCP_KEEPIDLE,60L);
//
curl_easy_setopt(curl, CURLOPT_TCP_KEEPINTVL, 30L);
//
curl_easy_setopt(curl, CURLOPT_TIMEOUT, 600L);//600s timeout
CURLcode res = curl_easy_perform(curl);
if(res == CURLE_OK) {
//7.65.3 will come here
} else {
//timeout
//new version will come here 8.9.0,8.9.1
}`
I expected the following
keep alive
curl/libcurl version
version 7.65.3 works
version 8.9.0 or 8.9.1 does'nt work
operating system
win10,with openssl 3.3.1