curl-library
Re: fetching fixed url from different interfaces & connection cache problem
Date: Fri, 28 Jan 2011 10:51:24 +0100 (CET)
On Fri, 28 Jan 2011, Pavel Gushcha wrote:
> I wrote application using curl_multi. This application must fetch each
> second some fixed url, but each time from different ip (i have 20 ip on my
> server). Firstly, i wrote application without requirement to use different
> IPs and all works good. Then i added option to each curl easy handle before
> adding it to curl_multi:
>
> curl_easy_setopt(easy_handle,CURLOPT_INTERFACE,<next ip>)
>
> And i expected, that this is all, what needed. But really ip was not
> changing each request. It was changed around each 20 requests. After problem
> exploration i figured out, that adding following option to easy handle fixes
> the problem:
>
> curl_easy_setopt(easy_handle,CURLOPT_FORBID_REUSE,1)
You've fallen into the same trap/bug/glitch that someone else did a short
while ago with pipelining and CURLOPT_INTERFACE: libcurl doesn't check the
desired source ip/port when it searches for a connection to re-use but is
happy if it targets the correct destination host.
This is a bug that should be fixed, and since you have a use-case here it
would be great if you could look into this.
The function that takes care of finding a connection to re-use is
lib/url.c:ConnectionExists().
> PS: sorry for my bad english.
No problems at all, we can understand you perfectly!
-- / daniel.haxx.se ------------------------------------------------------------------- List admin: http://cool.haxx.se/list/listinfo/curl-library Etiquette: http://curl.haxx.se/mail/etiquette.htmlReceived on 2011-01-28