curl-library
Re: Bug: Ignored port setting
Date: Thu, 31 Jan 2019 10:53:29 +0100 (CET)
On Thu, 31 Jan 2019, Michael Jungnickl via curl-library wrote:
> #define ZOTERO_PWP_URL "http://127.0.0.1:23116" //
> scheme://host:port/path
> curl_easy_setopt(curl, CURLOPT_URL, (char*) ZOTERO_PWP_URL);
> But I can't connect, in this way:
> #define ZOTERO_PWP_URL "http://127.0.0.1" // scheme://host:port/path
> #define ZOTERO_PWP_PORT 23116
> curl_global_init(CURL_GLOBAL_ALL);
> curl = curl_easy_init();
> curl_easy_setopt(curl, CURLOPT_URL, (char*) ZOTERO_PWP_URL);
> curl_easy_setopt(curl, CURLOPT_LOCALPORT, (long) ZOTERO_PWP_PORT);
The documentation explains it:
CURLOPT_LOCALPORT - set local port number to use for socket
Your two different takes are completely different.
In the first case you connect to TCP port 23116 on address 127.0.0.1 with a
random source port.
In the second case, you connect to TCP port 80 (the default HTTP port) on
address 127.0.0.1 with a fixed source port set to 23116.
I think you might be looking for CURLOPT_PORT, but why not just set it in the
URL as in the first case and be happy with that?
-- / daniel.haxx.se
-------------------------------------------------------------------
Unsubscribe: https://cool.haxx.se/list/listinfo/curl-library
Etiquette: https://curl.haxx.se/mail/etiquette.html
Received on 2019-01-31