curl / Mailing Lists / curl-library / Single Mail

curl-library

Re: Bug: Ignored port setting

From: Chris Carlmar via curl-library <curl-library_at_cool.haxx.se>
Date: Thu, 31 Jan 2019 10:54:55 +0100

On 31.01.2019 10:44, Michael Jungnickl via curl-library wrote:
> I think I found a bug in the cURL library.
> I run it with Windows 10.
>
> In this case  I can connect:
>
> #define ZOTERO_PWP_URL "http://127.0.0.1:23116"     //
> scheme://host:port/path
> 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_CONNECT_ONLY,    1);
> curl_easy_perform(curl);
>
> 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);
> curl_easy_setopt(curl, CURLOPT_CONNECT_ONLY,    1);
> curl_easy_perform(curl);
>
> The call below doesn't work.
> curl_easy_setopt(curl, CURLOPT_LOCALPORT,        (long) ZOTERO_PWP_PORT);
>

You want to set CURLOPT_PORT to the port you want to connect to.
CURLOPT_LOCALPORT is the port curl connect from.

--
mvh
Chris Carlmar
-------------------------------------------------------------------
Unsubscribe: https://cool.haxx.se/list/listinfo/curl-library
Etiquette:   https://curl.haxx.se/mail/etiquette.html
Received on 2019-01-31