I expected my CURLOPT_RESOLVE to still have effect on c2. However it does not.
It's interesting that the message
"Added foo.net:80:127.0.0.1 to DNS cache"
never appears so it looks like it's neither done for the first curl handle nor c2.
Moving the setopt for RESOLVE to c2 works.
I can't really find anything in the documentation that would hint to this behaviour.
My tentative fix above also adds a test for this. I think the only thing to add is to use caution with this since now both handles use the same list so you must make sure to not free the list until both are done with it!