Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

option CURLOPT_TCP_KEEPALIVE doesn't work with new version #14368

Closed
feelingseas opened this issue Aug 3, 2024 · 5 comments
Closed

option CURLOPT_TCP_KEEPALIVE doesn't work with new version #14368

feelingseas opened this issue Aug 3, 2024 · 5 comments
Labels
Windows Windows-specific

Comments

@feelingseas
Copy link

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

@bagder bagder added the Windows Windows-specific label Aug 3, 2024
@feelingseas
Copy link
Author

feelingseas commented Aug 3, 2024

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.

@feelingseas feelingseas reopened this Aug 3, 2024
@bagder
Copy link
Member

bagder commented Aug 3, 2024

Tell us how you build your libcurl. Or maybe single-step through tcpkeepalive and tell us where it goes wrong?

tcpkeepalive(struct Curl_easy *data,

@feelingseas
Copy link
Author

I use cmake-gui to configure,and vs2019 compiled.Like this .
I really sorry for my bad english.Also ,I can just use libaries ,not good at c/c++ details.Curl includes many net protocals ,It makes me confused.
I may waste your time ,sorry for that.
curl-keep-alive

@feelingseas
Copy link
Author

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 done

@samjessup
Copy link
Contributor

samjessup commented Aug 19, 2024

I 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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Windows Windows-specific
Development

Successfully merging a pull request may close this issue.

3 participants