php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #69047 CURLOPT_IPRESOLVE change for next curl_exec has no effect
Submitted: 2015-02-12 22:15 UTC Modified: 2015-02-12 22:52 UTC
From: vali2015 at validom dot de Assigned:
Status: Not a bug Package: cURL related
PHP Version: 5.4.37 OS: Debian
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: vali2015 at validom dot de
New email:
PHP Version: OS:

 

 [2015-02-12 22:15 UTC] vali2015 at validom dot de
Description:
------------
When using multiple curl_exec calls but using different CURLOPT_IPRESOLVE settings, the first setting takes effect regardless of what you set in the next calls.

Test script:
---------------
Precondition: two hosts with IPv4 AND IPv6. 
Place the script returning your remote address on one server and the test-script on the other. Execute the test-script.

Code:
http://pastebin.com/M1tfCtuq

The test-script eliminates cache-issues on both servers by using random additions to the URL fetched

Expected result:
----------------
CURLOPT_IPRESOLVE should take effect on each call, especially in combination with CURLOPT_FRESH_CONNECT

Actual result:
--------------
there is always the connection-type used which was used for the first connect

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2015-02-12 22:52 UTC] requinix@php.net
-Status: Open +Status: Not a bug
 [2015-02-12 22:52 UTC] requinix@php.net
The cURL library caches hostname lookups (in additional to reusing connections).

You can disable it globally with CURLOPT_DNS_USE_GLOBAL_CACHE=false (default true), or individually set CURLOPT_DNS_CACHE_TIMEOUT=0 (default two minutes) for the cache entry to expire when you close the connection.
 [2015-02-12 22:57 UTC] vali2015 at validom dot de
This solves it, thanks so much!
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Fri May 09 13:01:28 2025 UTC