Skip to content

ios 9.x - ipv6 Test not work.. (CURLE_COULDNT_CONNECT) #594

Closed

Description

@masteage

setting

  • curl version
    • v7.39.0 , v7.40.0
  • device
    • iPhone 5s , ios 9.1
  • Xcode version
    • 6.4
  • wifi
    • Mac OS X El Capitan shared wifi (NAT64)

error

  • CURLE_COULDNT_CONNECT (7)

state

  • version info data
    • curl_version_info_data->features (573980) ,CURL_VERSION_IPV6 == false.
  • CURLOPT_IPRESOLVE
    • default (CURL_IPRESOLVE_WHATEVER)
  • url
    • ipv6 able (other ios native api use test)

question

  • how to solve this..

Activity

  1. bagder commented on Jan 8, 2016

    @bagder
    Member

    Are you running a program that works fine otherwise on other platforms (like native mac) ?

    CURLE_COULDNT_CONNECT means libcurl failed to establish a TCP connection to the remote host (and port). Are you sure you're supposed to be able to without using a proxy or any other similar means? Can you telnet to that host + port from the same machine that curl fails to work on?

    Can you generate a full VERBOSE-enabled log for when you do this and show us?

    I don't think we have many iPhone users among or developers so I think you're left a bit on your own to further debug this. But me knowingly, it should just work fine on iOS as well.

    Have you gotten this to work with any other libcurl version?

  2. masteage commented on Jan 8, 2016

    @masteage
    Author
  3. bagder commented on Jan 8, 2016

    @bagder
    Member

    if ipv4 works and ipv6 doesn't, that sounds more like an OS issue then anything else to me. libcurl really doesn't do much difference between IP versions and CURLE_COULDNT_CONNECT means that connect() returned a failure. What else can we do?

  4. masteage commented on Jan 8, 2016

    @masteage
    Author

    thanks, your answer.
    i will more test ... (other network , os, device)

  5. masteage commented on Jan 8, 2016

    @masteage
    Author

    (1) how to check ipv6 able?

    • curl_version_info->features & CURL_VERSION_IPV6 check is

    (2) if ipv6 check is “curl_version_info->features & CURL_VERSION_IPV6” ,
    this value when change? [lib time change(setting) or runtime change?]

    (3) hot to set ipv6 able ?

    • in code able ?

    (etc) curl_version_info->features value (ipv6 not work state)

    • 573980 (false values)
      • CURL_VERSION_IPV6
      • CURL_VERSION_KERBEROS4
      • CURL_VERSION_GSSNEGOTIATE
      • CURL_VERSION_DEBUG
      • CURL_VERSION_ASYNCHDNS
      • CURL_VERSION_SPNEGO
      • CURL_VERSION_IDN
      • CURL_VERSION_SSPI
      • CURL_VERSION_CONV
      • CURL_VERSION_CURLDEBUG
      • CURL_VERSION_HTTP2
      • CURL_VERSION_GSSAPI
      • CURL_VERSION_KERBEROS5

    (my code)
    curl_easy_setopt(curl, CURLOPT_URL, url);
    header = curl_slist_append( header , "Content-Type: text/html");
    curl_easy_setopt( curl , CURLOPT_HTTPHEADER , header );
    curl_easy_setopt( curl , CURLOPT_WRITEFUNCTION, func);
    curl_easy_setopt( curl , CURLOPT_WRITEHEADER, strRecvHeader);
    curl_easy_setopt( curl , CURLOPT_WRITEDATA, strRecvBody);
    curl_easy_setopt( curl , CURLOPT_POSTFIELDS , strData.c_str() );
    curl_easy_setopt( curl , CURLOPT_POST , true );
    curl_easy_setopt( curl, CURLOPT_TIMEOUT, 10);

    res = curl_easy_perform(curl);

  6. bagder commented on Jan 8, 2016

    @bagder
    Member

    The CURL_VERSION_IPV6 bit is set if libcurl "supports IPv6". With that set, it can resolve host names to IPv6 addresses. Without it, it can't so it can't do IPv6 at all. So if your libcurl is built without IPv6 support, the problem is not exactly what you've said (since you can't use IPv6) and again it would've showed in the VERBOSE log you have not shown us.

    You need a libcurl built to support IPv6 in order to use IPv6.

  7. bagder commented on Jan 11, 2016

    @bagder
    Member

    A libcurl without IPv6 support cannot speak IPv6.

  8. masteage commented on Jan 12, 2016

    @masteage
    Author

    (1) ios device is not VERBOSE log. (simulator is log has)

    (2) simulator log (normal case)

    *   Trying 80.67.6.50...
    * Connected to curl.haxx.se (80.67.6.50) port 80 (#0)
    > POST / HTTP/1.1
    Host: curl.haxx.se
    Accept: */*
    Content-Type: text/html
    Content-Length: 1388
    Expect: 100-continue
    
    < HTTP/1.1 100 Continue
    < HTTP/1.1 200 OK
    < Date: Tue, 12 Jan 2016 01:25:45 GMT
    < Server: Apache
    < Upgrade: h2c
    < Connection: Upgrade
    < Last-Modified: Mon, 11 Jan 2016 03:05:02 GMT
    < ETag: "bda-5290634075674"
    < Accept-Ranges: bytes
    < Content-Length: 3034
    < Vary: Accept-Encoding
    < Content-Type: text/html
    < 
    * Connection #0 to host curl.haxx.se left intact
  9. bagder commented on Jan 12, 2016

    @bagder
    Member

    But that "normal case" shows it only using IPv4... An IPv6 capable curl would be more likely to say this:

    $ curl -v curl.haxx.se
    * Rebuilt URL to: curl.haxx.se/
    *   Trying 2a00:1a28:1200:9::2...
    * Connected to curl.haxx.se (2a00:1a28:1200:9::2) port 80 (#0)
    > GET / HTTP/1.1
    > Host: curl.haxx.se
    > User-Agent: curl/7.46.0
    > Accept: */*
    > 
    < HTTP/1.1 200 OK
    < Date: Tue, 12 Jan 2016 07:41:29 GMT
    < Server: Apache
    
  10. masteage commented on Jan 12, 2016

    @masteage
    Author

    (1) yes, "normal case" is using IPv4 (ios simulator)
    (2) i used cocos2s-x's curl lib (ios device is not enabled)
    (3) my build lib - ios device is not enabled setting , why ??? i just default build. (from v0.7.40)

    • i386 , x86_64 is "checking whether to enable IPv6... yes"
    • armv7 , arm64 is "checking whether to enable IPv6... no"
  11. bagder commented on Jan 12, 2016

    @bagder
    Member

    When it says 'no', load the config.log file and search for the ipv6 test and you'll see what it tried to do and what failed. I think the problem is that when you cross-compile, that test doesn't really work. I would probably recommend you to manually edit lib/curl_config.h after configure has run and enable IPv6 there.

  12. bagder commented on Jan 12, 2016

    @bagder
    Member

    I will actually switch the default for that for the next curl version.

  13. masteage commented on Jan 12, 2016

    @masteage
    Author

    thanks, your answer.
    my default setting is bug.
    add "--enable-ipv6" is solution.
    and, change default setting thanks.

  14. flyingsky commented on Aug 20, 2016

    @flyingsky

    @masteage Is you app approved after change? I use https://github.com/sinofool/build-libcurl-ios to build curl with openssl, it can pass the DNS64/NAT64 local settings. But it's still rejected on Apple review ipv6 environment.

  15. SpringMT commented on Sep 2, 2016

    @SpringMT

    @flyingsky Is Apple review still rejected?

  16. reasten commented on Feb 8, 2017

    @reasten

    Under IPV6 environment, curl returns ok while running on simulators, but curl returns error while running on real iPhone device.I added the following code in my program to check IPV6 features:
    curl_version_info_data *d=curl_version_info(CURLVERSION_NOW);
    printf("feature=%04x, CURL_VERSION_IPV6=%d\n ",d->features, CURL_VERSION_IPV6);
    The results shows the followings:
    (1) CURL_VERSION_IPV6=1 under both emulators and real devices
    (2) the lowest bit of features = 1 under emulators
    (3) the lowest bit of features = 0 under real devices
    according to ./lib/version.c if Enable_IPV6, the lowest bit(CURL_VERSION_IPV6) should be 1. but du to some faults, it is set to 0 under armv7 , arm64.

  17. jay commented on Feb 8, 2017

    @jay
    Member

    (1) CURL_VERSION_IPV6=1 under both emulators and real devices
    (2) the lowest bit of features = 1 under emulators
    (3) the lowest bit of features = 0 under real devices

    That feature is set at built time, so if you build libcurl with IPv6 support it will always show that bit in features. Also please don't piggyback on this issue. If you have libcurl questions ask them on the mailing list, or if you have a bug you can file it as a separate issue. I'm 99% sure that's not a bug though, very likely you are running some different version of libcurl not built with IPv6 support.

  18. locked as resolved and limited conversation to collaborators on May 6, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions