-
-
Notifications
You must be signed in to change notification settings - Fork 7.1k
Closed
Description
I did this
Using the easy interface and the CURLOPT_TCP_FASTOPEN option, fetch a webpage. Then look for CURLINFO_LOCAL_PORT.
#include <stdio.h>
#include <curl/curl.h>
int main(void)
{
CURL *curl;
CURLcode res;
curl = curl_easy_init();
if(curl) {
curl_easy_setopt(curl, CURLOPT_URL, "http://pathspider.net/");
curl_easy_setopt(curl, CURLOPT_TCP_FASTOPEN, 1);
res = curl_easy_perform(curl);
if(CURLE_OK == res) {
long *ct;
res = curl_easy_getinfo(curl, CURLINFO_LOCAL_PORT, &ct);
if((CURLE_OK == res) && ct == NULL) {
printf("The operating was successful but we got nothing!\n");
} else {
printf("We used local port: %d\n", *ct);
}
}
curl_easy_cleanup(curl);
}
return 0;
}
Instead of getting a port, I got a NULL, which is suboptimal for my use case.
I expected the following
A source port.
curl/libcurl version
curl 7.52.1 (x86_64-pc-linux-gnu) libcurl/7.52.1 OpenSSL/1.0.2k zlib/1.2.8 libidn2/0.16 libpsl/0.17.0 (+libidn2/0.16) libssh2/1.7.0 nghttp2/1.18.1 librtmp/2.3
Protocols: dict file ftp ftps gopher http https imap imaps ldap ldaps pop3 pop3s rtmp rtsp scp sftp smb smbs smtp smtps telnet tftp
Features: AsynchDNS IDN IPv6 Largefile GSS-API Kerberos SPNEGO NTLM NTLM_WB SSL libz TLS-SRP HTTP2 UnixSockets HTTPS-proxy PSL
operating system
Debian testing (curl 7.52.1-3)
Reactions are currently unavailable