Uploaded image for project: 'RHEL'
  1. RHEL
  2. RHEL-27190

libcurl CURLINFO_LOCAL_PORT fails when reusing easy handle

    • Icon: Bug Bug
    • Resolution: Won't Do
    • Icon: Minor Minor
    • rhel-8.10.z
    • rhel-8.6.0, rhel-9.3.0
    • curl
    • None
    • None
    • Low
    • EasyFix
    • 285f2e7b87ac66e405066747495a70f666915a24
    • sst_cs_plumbers
    • ssg_core_services
    • 3
    • False
    • Hide

      None

      Show
      None
    • None
    • Red Hat Enterprise Linux
    • None
    • None
    • None
    • All
    • None

      What were you trying to do that didn't work?

      Calling:

      libcurl_easy_getinfo(CURLE*, CURLINFO_LOCAL_PORT, long*)

      after reusing the easy handle leads to the port being set to -1 instead of the last

      used port.

      Please provide the package NVR for which bug is seen:

      libcurl-devel-7.76.1-26.el9_3.2.x86_64

      How reproducible:

      Always

      Steps to reproduce

      1. Simple C++ program

      #include <curl/curl.h>
      #include <iostream>
      #include <unistd.h>
      #include <stdlib.h>

      int main()

      {     curl_global_init(CURL_GLOBAL_ALL);     CURL* easyHandle = curl_easy_init();     curl_easy_setopt(easyHandle, CURLOPT_URL, "http://google.com");     long port;     curl_easy_perform(easyHandle);     curl_easy_getinfo(easyHandle, CURLINFO_LOCAL_PORT, &port);     std::cout << "Local port: " << port << std::endl;     curl_easy_perform(easyHandle);     curl_easy_getinfo(easyHandle, CURLINFO_LOCAL_PORT, &port);     std::cout << "Local port: " << port << std::endl;     return 0; }

           2. Compile

       g++ -lcurl main.cpp

       

           3. Run program

       

      Expected results

      Local port: 42732

      Local port: <some_valid_port_number>

      Actual results

      Local port: 42732

      Local port: -1

       

      NOTE:

      This issue is fixed in

      https://github.com/jbrownsw/curl/commit/285f2e7b87ac66e405066747495a70f666915a24

            jmigacz@redhat.com Jacek Migacz
            rhubenov Radoslav Hubenov (Inactive)
            Jacek Migacz Jacek Migacz
            Daniel Rusek Daniel Rusek
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: